Prior to "ResetControl" a separate button with the following code shows the array for tData but nothing for tText
Code: Select all
on mouseUp
put the dgData of group "Results" into tData
put the dgText of group "Results" into tText
end mouseUp
Code: Select all
on mouseUp
put the selection into tSQL
if tSQL is empty then
answer information "A SQL statement must be selected for execution." titled "Execute SQL" as sheet
exit mouseUp
end if
put word 1 of tSQL into tType
switch tType
case "Select"
put revQueryDatabase(getDatabaseID(), tSQL) into tCursor
if tCursor is not an integer then
answer "Error: Unable to fetch account info -" && tCursor
exit mouseUp
end if
set the dgText of group "Results" to empty
put databaseFetchDataFromCursorAsArray(tCursor) into tArray
repeat with i=1 to 30
put "Col " & i into tColName
set the dgColumnLabel[tColName] of group "Results" to tColName
end repeat
put tArray[1] into tSingle
put the keys of tSingle into tKeys --each line of tKeys is a column name
put the number of lines of tKeys into tCount
repeat with i=1 to tCount
put line i of tKeys into tColName
put "Col " & i into tOldCol
set the dgColumnLabel[tOldCol] of group "Results" to tColName
end repeat
set the dgData of group "Results" to tArray
break
case "Update"
answer "UPDATE not written yet."
break
case "Delete"
asnwer "DELETE not written yet."
break
default
answer tType
end switch
end mouseUp
Larry