Reputation: 89
I have created a sqlite table in Livecode
put "CREATE TABLE Chapter(ID INTEGER, Units TEXT, UUID INTEGER)" into tSQL
revExecuteSQL tDatabaseID, tSQL
Selecting Row from Datagrid code:
put the dgData of group "DataGrid 1" into tData1
put the dgHilitedLines of group "DataGrid 1" into tIndexes
repeat for each item tIndex in tIndexes
put tData1[tIndex]["Unit"] into theUnit
put "Insert into Chapter(ID,Units,UUID) values('15','"theUnit"','5');" into tSQL
revExecuteSQL tDatabaseID, tSQL
end repeat
The Above code is saving only one Hilited row in database.
But,My Question is that I want to save more than one row in Units column of my table upon multiple hilited rows in datagrid.
please suggest if there is any other method to save multiple rows from datagrid in database.
Upvotes: 1
Views: 768
Reputation: 691
Please find a sample stack in the following link that allows you to save multiple hightligted lines of a datagrid to a SQLite database. To create this stack I amended the sample provided in the LiveCode SQLite database lesson-
http://techsupport.on-rev.com/test/Sqlite_Example.livecode
I had to slightly amend your selecting from Row datagrid code as I was receiving an compilation error when copy & pasting it.
Hopefully this will give you some leads.
Upvotes: 1