Please help. Datagrid Form not showing any data
Posted: Tue Oct 06, 2015 6:28 am
I am having difficulty with getting the Datagrid to work.
I need to display a list of users with their user names and pictures in a datagrid.
I have followed all the tutorials and am pretty sure i am doing everything correctly.
I have created the datagrid.
I have selected form under style
I have edited the row template as per the instructions in various tutorials and videos
I coded the fillindata and other revelant row behaviors.
Still nothing shows up in my datagrid?
See the code below. (to simplify i am not trying to show the picture just the data field called UserName)
on FillInData theDataGridArray
global gConnectionID, gDetailList
put revOpenDatabase( "ODBC" ,"DRIVER=SQL Server;SERVER=L0610023709\SQLEXPRESS;DATABASE=POT;UID=sa;PWD=g66n85j03;Trusted_Connection=No" ,,,) into gConnectionID
put "SELECT UserName FROM PotUser" into tDetails
put revQueryDatabase( gConnectionID, tDetails) into gDetailList
ConvertSQLCursorToArray gDetailList, theDataGridArray
lock screen
set the dgData of group "DataGrid 1" of me to theDataGridArray
set the dgHilitedLines of group "DataGrid 1" of me to 1
repeat with x = 1 to 2
set the text of field ("UserName" ) of me to theDataGridArray[x]["UserName"]
##answer theDataGridArray[x]["UserName"]
end repeat
unlock screen
revCloseCursor gDetailList
revCloseDatabase gConnectionID
end FillInData
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)
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
I need to display a list of users with their user names and pictures in a datagrid.
I have followed all the tutorials and am pretty sure i am doing everything correctly.
I have created the datagrid.
I have selected form under style
I have edited the row template as per the instructions in various tutorials and videos
I coded the fillindata and other revelant row behaviors.
Still nothing shows up in my datagrid?
See the code below. (to simplify i am not trying to show the picture just the data field called UserName)
on FillInData theDataGridArray
global gConnectionID, gDetailList
put revOpenDatabase( "ODBC" ,"DRIVER=SQL Server;SERVER=L0610023709\SQLEXPRESS;DATABASE=POT;UID=sa;PWD=g66n85j03;Trusted_Connection=No" ,,,) into gConnectionID
put "SELECT UserName FROM PotUser" into tDetails
put revQueryDatabase( gConnectionID, tDetails) into gDetailList
ConvertSQLCursorToArray gDetailList, theDataGridArray
lock screen
set the dgData of group "DataGrid 1" of me to theDataGridArray
set the dgHilitedLines of group "DataGrid 1" of me to 1
repeat with x = 1 to 2
set the text of field ("UserName" ) of me to theDataGridArray[x]["UserName"]
##answer theDataGridArray[x]["UserName"]
end repeat
unlock screen
revCloseCursor gDetailList
revCloseDatabase gConnectionID
end FillInData
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)
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