In my database i have columns with Varchars and one for picture in BLOB.
I am experiencing an issue to loop through the datagrid array so that it is displayed in a datagrid form!
Below is my code for the "populate button" that will be used to populate the "datagrid form".
Code: Select all
command uiPopulatePeople
## Connect to the database
put "mysql" into theDBType
put "127.0.0.1:3306" into theDBHost
put "wisdom" into theDBName
put "root" into theDBUser
put "root" into theDBPassword
put revOpenDatabase( theDBType, theDBHost, theDBName, theDBUser, theDBPassword ) into theConnectionID
if theConnectionID is an integer then
## Query the database for data
put "SELECT * FROM admin" into tQuery
put revQueryDatabase( theConnectionID, tQuery, "tIndex") into theCursor
if theCursor is not empty then
//take the image from the Query result
put revDatabaseColumnNamed(theCursor, "picture", "tImageData") into tErrorMsg
//Show the image in the imageBox
else
answer "Error Cursor: Reading from DB"
end if
//Close the Cursor with Query Result
revCloseCursor theCursor
else
answer "Error connecting to the database:" && theConnectionID & "."
end if
//Close the DB Connection ID
revCloseDatabase theConnectionID
------------------------------------------------------ I want to loop in this section--- HELP
put "Lucky" into theDataA[1]["FirstName"]
put "Day" into theDataA[1]["LastName"]
put "Three Amigo" into theDataA[1]["Title"]
put tImageData into theDataA[1]["Image URL"]
-----------------------------------------------------
lock screen
set the dgData of group "DataGrid 1" to theDataA
## Hilite first row
set the dgHilitedLines of group "DataGrid 1" to 1
unlock screen
end uiPopulatePeople
Please your help would be much appreciated