M
mazheng
Unregistered / Unconfirmed
GUEST, unregistred user!
是这样 我在delphi需要操作SQLite数据库,所以装了ASQLite3 组件。 窗体上放了 asqlt3db1: TASQLite3DB; asqlt3qry1: TASQLite3Query; asqlt3pdtsql1: TASQLite3UpdateSQL; ds1: TDataSource; dbgrd1: TDBGrid; dbnvgr1: TDBNavigator; 各个组件连接好了后,操作数据表。修改了一个字段后,点击 DBNavigator 的保存按钮 后就出错。 一开始 我是这样写。是按照 ASQLite3 组件实例程序代码:asqlt3pdtsql1.UpdateSQL.Text:='update comp * where ID=:ID'; 运行环后出错:“SQL macro syntax error on sql, expected ” 然后我自己写代码如下: procedure TForm1.FormCreate(Sender: TObject); var s:string; i:integer; begin s:=''; asqlt3pdtsql1.InsertSQL.Text:='insert into comp *'; asqlt3pdtsql1.DeleteSQL.Text:='delete from comp where ID=:ID'; asqlt3pdtsql1.UpdateSQL.Text:=''; asqlt3qry1.Open; for i:=0 to asqlt3qry1.Fields.Count-1 do begin s:=s+asqlt3qry1.Fields.Fields.DisplayName+' =:'+asqlt3qry1.Fields.Fields.DisplayName; if i = asqlt3qry1.Fields.Count-1 then s := s + ' where ID=:ID' else s := s + ','; end; asqlt3pdtsql1.UpdateSQL.Text:='update comp set '+S; end; 运行后 出现错误提示: --------------------------- Project1 +++++++++++++++++++++ --------------------------- IDVnd0 not found --------------------------- OK --------------------------- IDVnd0 是 ID字段 和 Vnd0字段,怎么会成了IDVnd0一个字段? 请 各位达人赐教!!! 谢谢!!