1

在 Livecode 中创建了一个 sqlite 表

将“CREATE TABLE Chapter(ID INTEGER, Units TEXT, UUID INTEGER)”放入 tSQL

    revExecuteSQL tDatabaseID, tSQL

从 Datagrid 代码中选择行:

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

上面的代码在数据库中只保存了一个 Hilited 行。

但是,我的问题是,我想在 datagrid 中的多个 hilited 行上在我的表的 Units 列中保存不止一行。

请建议是否有任何其他方法可以从数据库中的数据网格中保存多行。

4

1 回答 1

1

请在以下链接中找到一个示例堆栈,该堆栈允许您将数据网格的多个高亮行保存到 SQLite 数据库。为了创建这个堆栈,我修改了 LiveCode SQLite 数据库课程中提供的示例——

http://techsupport.on-rev.com/test/Sqlite_Example.livecode

我不得不稍微修改您从 Row datagrid 代码中的选择,因为我在复制和粘贴时收到编译错误。

希望这会给你一些线索。

于 2013-10-10T11:02:49.293 回答