hello,
i want to make a data grid form which should get get multiple datas from database and set them in a form. i tried a lesson on runrev website but keep getting a function error.
I would be glad if someone could look into the script an help me out.
on mouseUp
## Connect to the database
put "mysql" into theDBType
put "
www.runrev.com" into theDBHost
put "runrev_test" into theDBName
put "runrev_example" into theDBUser
put "example" into theDBPassword
put revOpenDatabase( theDBType, theDBHost, theDBName, theDBUser, theDBPassword ) into theConnectionID
if theConnectionID is an integer then
## Query the database for data
put revQueryDatabase( theConnectionID, "SELECT * FROM Table1") into theCursor
if theCursor is an integer then
ConvertSQLCursorToArray theCursor, theDataGridArray
put the result into theError
if theError is empty then
## The cursor was successfully converted to an array.
## Assign it to the data grid. The 'firstname' and 'lastname' columns
## from the database cursor will appear in the matching columns
## in the data grid.
set the dgData of group "DataGrid 1" to theDataGridArray
end if
## Close the database cursor
revCloseCursor theCursor
end if
## Close the database connection
revCloseDatabase theConnectionID
else
answer "Error connecting to the database:" && theConnectionID & "."
end if
end mouseUp
command ConvertSQLCursorToArray pCursor, @pOutArrayA
local i
local theFields
local theError
## Get the names of all the columns in the database cursor
put revDatabaseColumnNames(pCursor) into theFields
if theFields begins with "revdberr," then
put item 2 to -1 of theFields into theError
end if
if theError is empty then
put 0 into i
## Loop through all rows in cursor
repeat until revQueryIsAtEnd(pCursor)
########## error function error revQueryisAtEnd
add 1 to i
## Move all fields in row into next dimension of the array
repeat for each item theField in theFields
put revDatabaseColumnNamed(pCursor, theField) into pOutArrayA
[ theField ]
end repeat
revMoveToNextRecord pCursor
end repeat
end if
return theError
end ConvertSQLCursorToArray