This code is from the quick tutorial of the firefly help section.
I wanted to try this out to see If I could get it to function. When I try to compile this code I get an error # 516 thrown up
From the powerbasic compiler.
It tells me that : lpConnection = FF_AdoCreateObject("ADODB.Connection") Is not correctly defined. Looking at the code below, I can see that IpConnection is setup as Dword. So It must be FF_AdoCreateObject That is giving me the trouble.
I'm using FireFly 2.95 and PowerBasic 9.0. Should this code, being as it is in the tutorial section be able to run by copy and paste? Is FF_AdoCreateObject a wrapper? I'm still new to this powerbasic programming. Does anybody have some example
code that is written in Firefly that will connect to a database ? (Microsoft Access)
'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND1_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
Local lpConnection As Dword
Local ConStr As String
' Creates an ADO connection object
lpConnection = FF_AdoCreateObject("ADODB.Connection")
If IsFalse lpConnection Then Exit Function
' Connection string - Remember to change the path of the Data Source
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "biblio.mdb"
' Opens the database
FF_AdoConnection_Open lpConnection, ConStr
If FF_AdoResult Then GoTo Terminate
' *** code here to manipulate the database ***
Terminate:
' Close and release the connection
If lpConnection Then
FF_AdoConnection_Close lpConnection
FF_AdoRelease lpConnection
End If
End Function
How Do I find out what all of the FF_ Functions are?
Hi Robert,
Under "Project", "Project Properties", make sure that you have the following checkbox ticked: "Include ADO code support in the project (ActiveX Data Objects)"
The FF_Functions are described in the FF_Functions.chm help file.
Thankyou,
That worked wonderful. I should have remembered that as I have been doing a lot of reading about data base operations
on this site. I do believe that was covered in a prior thread.
Shame on me for not researching it further.
Robert