【发布时间】:2015-09-13 21:05:52
【问题描述】:
我在 livecode 中有一个数据网格。我想在用户对数据网格的一行进行更改后更新底层数据库中的数据
嗨,马尔特,
这看起来很有希望。唯一的问题是数据库表中的name字段与列名不一样。我想使用 sql update 语句来更新数据库。我尝试了以下代码
on CloseFieldEditor pFieldEditor
--Connect to database
databaseConnect
--Update Record
put GetDataOfLine( the dgHilitedlines of me,"Pathogen") into strPathogen
put GetDataOfLine( the dgHilitedlines of me,"Offset") into strIncubation
put GetDataOfLine( the dgHilitedlines of me,"Duration") into strDurationofIllness
put GetDataOfLine( the dgHilitedlines of me,"ID") into IntID
put "UPDATE tblPathogen SET fldPathogenName='" & strPathogen & "', fldIncubation='" & strIncubation & "', fldDurationofIllness='" & strDurationofIllness & "'" into strSQL
put " WHERE fldPathogenID=" & IntID after strsql
put strsql into field "test"
--SaveDataToDatabase theTable, theRowID, theColumnBeingEdited, theNewText
end CloseFieldEditor
问题是网格中的值在分配给变量之前会变回原始值。如何更新网格以保存 pFieldEditor 的文本
【问题讨论】: