Restored from previous forum. Originally posted by effigy.
Below is an example of where I'm having a problem. (I think I'm just using the odbc open and init functions wrong)
If InitDatabase()
If OpenDatabase(21, "cal", "", "")
Else
MessageRequester("Alert","Database could not be opened!",#PB_MessageRequester_Ok )
EndIf
Else
MessageRequester("Alert","ODBC could not be initialized!",#PB_MessageRequester_Ok )
EndIf
Procedure getcalinfo(begindate, enddate)
dbquery.s="select * from schedule"
If DatabaseQuery("select * from schedule")
NextDatabaseRow()
MessageRequester("Alert","Data Received",#PB_MessageRequester_Ok )
Else
MessageRequester("Alert","DB Query Failed or empty",#PB_MessageRequester_Ok )
EndIf
EndProcedure
Dim test(100)
getcalinfo(Date(2003,03,26,09,30,00),Date(2003,03,26,10,30,00))
My problem is... this code wont make the connection... the Query Failed message comes up.
However if I remove the Dim command then the query works????
Do I have to init the connection everytime I start a query, or only once?
Thanks
Derek
Problem with ODBC Code
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by effigy.
As an aside to what I already posted...
I started getting a Microsoft ODBC error now... and the only way I
could make it stop was to move my initdatabase() before my variable declarations???
Yet I couldn't duplicate the error in a smaller program for testing.
Hmmm... any more thoughts?
As an aside to what I already posted...
I started getting a Microsoft ODBC error now... and the only way I
could make it stop was to move my initdatabase() before my variable declarations???
Yet I couldn't duplicate the error in a smaller program for testing.
Hmmm... any more thoughts?