My table in sqlLite has 6 records, but the datagrid repeats the last record twice.
If I delete 1 record, I repeat it 3 times and if I delete another 4 times.
Function fDespliega_Carta
put "" into tPaso
put revQueryDatabase( gSQLiteID, "SELECT * FROM carta order by carta_codigo ASC" ) into theCursor
put revDatabaseColumnNames(theCursor) into theFields
ConvertSQLCursorToArray theCursor, theDataGridArray
put the result into theError
if theError is empty then
set the dgData of group "DataGrid_1" to theDataGridArray
end if
end fDespliega_Carta
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
if theField = "carta_precio" then
put numFormat(revDatabaseColumnNamed(pCursor, theField),"$#.###.###.##Z") into pOutArrayA[ theField ]
else
put revDatabaseColumnNamed(pCursor, theField) into pOutArrayA[ theField ]
end if
end repeat
revMoveToNextRecord pCursor
end repeat
end if
return theError
end ConvertSQLCursorToArray
Problem with DataGrid and sqlLite
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Problem with DataGrid and sqlLite
Did you try with this?
Code: Select all
set the dgText of group "DataGrid_1" to revDataFromQuery(TAB, return, gSQLiteID, "SELECT * FROM carta order by carta_codigo ASC")
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Problem with DataGrid and sqlLite
MaxV, thanks.
It was that little detail ...
Greetings from the south of the world
It was that little detail ...
Greetings from the south of the world
Re: Problem with DataGrid and sqlLite
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Problem with DataGrid and sqlLite
Oh that is a good one Max