Page 1 of 1

Posted: Fri Mar 28, 2003 11:43 pm
by BackupUser
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

Posted: Sat Mar 29, 2003 12:20 am
by BackupUser
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?