Code: Select all
on mouseUp
-- check the global connection ID to make sure we have a database connection
global gConnectionID
if gConnectionID is not a number then
answer error "Please connect to the database first."
exit to top
end if
put field SQLField into tSQL
put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData
//Couldn't even set columns successfully in advance
//put "Name,Attempts,Success" into theFields
//replace "," with CR in theFields
//answer theFields
//set the dgProp ["columns"] of group "DataGrid1" of card 3 to theFields
-- check the result and display the data or an error message
if item 1 of tData = "revdberr" then
answer error "There was a problem querying the database:" & cr & tData
else
put tData into field "Data"
put tData into field "TableField1" of card 2
--tried this but it didn't work
--put revDatabaseColumnNames(tData) into theFields -- get field names from table
--replace "," with CR in theFields
--set the dgProp["columns"] of group "DataGrid1" of card 3 to theFields
--put tData into field "DataGrid1" of card ID 1078
put false into firstLineContainsColumnNames
set the dgText [firstLineContainsColumnNames ] of group "DataGrid1" of card 3 to tData
end if
end mouseUp