I have a database that I query via ODBC. DatabaseUpdate() and DatabaseQuery() work.
But I just realised that when I query the result of a DatabaseQuery(), for example with GetdatabaseString()
then the content is deleted if I first select a higher column first.
OK: GetdatabaseString( DBID, 0) + ", " + GetdatabaseString( DBID, 1)
Fails: GetdatabaseString( DBID, 1) + ", " + GetdatabaseString( DBID, 0) -> Value for 0 is empty
Can anyone reproduce this or have I already messed something up somewhere else?
Code: Select all
OpenDatabaseRequester(0, #PB_Database_ODBC)
; DatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('apple', '10')")
; DatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('pear', '5')")
; DatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('banana', '20')")
If DatabaseQuery(0, "SELECT name, weight FROM food WHERE")
While NextDatabaseRow(0)
Debug GetDatabaseString(0, 0) + ", " + GetDatabaseString(0, 1)
Wend
FinishDatabaseQuery(0)
EndIf
; Result:
;
; apple, 10
; paer, 5
; banana, 20
If DatabaseQuery(0, "SELECT name, weight FROM food WHERE")
While NextDatabaseRow(0)
Debug GetDatabaseString(0, 1) + ", " + GetDatabaseString(0, 0)
Wend
FinishDatabaseQuery(0)
EndIf
; Result:
;
; 10,
; 5,
; 20,
