我写入access表,老实提示'INSERT NTO 语句的语法错误。'(50分)

  • 主题发起人 主题发起人 jesseyzy
  • 开始时间 开始时间
J

jesseyzy

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TzhikongjieshouForm.BitBtn2Click(Sender: TObject);<br>var<br>&nbsp; &nbsp; &nbsp;QRYTMP:TADOQUERY;<br>&nbsp; &nbsp; &nbsp;DS:TDataSource ;<br>&nbsp; &nbsp; &nbsp; strsql,errmsg:string;<br>&nbsp; &nbsp; &nbsp;<br>begin<br><br><br>&nbsp; &nbsp; &nbsp; &nbsp;try &nbsp; &nbsp;//<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //如果在fromshow的事件里面创建qrytmp的话,在做第二次查询的时候<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //就回提示field jx的字段不存在。<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QryTmp:=TADOQuery.Create(self);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; qrytmp.Connection:=MyDataModule.ADOConn ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DS:=TDataSource.Create(SELF);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DS.DataSet:=qrytmp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dbgrid1.DataSource:=DS;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('cant CONNECT THE MyDataModule.ADOConn ;!');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp;;<br><br>&nbsp; &nbsp; &nbsp; with QryTmp do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:='';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { strsql:='insert into zhikong(id,DATE,TIME,WBC,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'KET,NIT,URO,GLU,BIL,PRO,BLD,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'CR,Ca,MA,shizhitype,zkyh)'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;STRSQL:=STRSQL+'values(:id,:DATE,:TIME,:WBC,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;STRSQL:=STRSQL+':KET,:NIT,:URO,:GLU,:BIL,:PRO,:BLD,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;STRSQL:=STRSQL+':CR,:Ca,:MA,:shizhitype,:zkyh)'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:='insert into zhikong(id,TIME,WBC,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'KET,NIT,URO,GLU,BIL,PRO,BLD,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'CR,Ca,MA,shizhitype,zkyh)'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql :=strsql+' &nbsp; &nbsp; &nbsp; &nbsp; valuse(:id,:TIME,:WBC,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+':KET,:NIT,:URO,:GLU,:BIL,:PRO,:BLD,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+':CR,:Ca,:MA,:shizhitype,:zkyh)'+char(13);<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // showmessage(strsql);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//sqlStr:='insert into jianyan_temp(jianyan_yingwen,jianyan_mincheng,temp,jianyan_cankaozhi) values('<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//+''''+updatetempADOQuery.Fields.FieldName+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//+''''+'*'+fill_ghx_ADOQuery.FieldByname('jianyan_zhongwen').AsString<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//+'('+updatetempADOQuery.Fields.FieldName+')'+''''+','+''''<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//+ trim(AnsiReplaceText(updatetempADOQuery.Fields.AsString,'*',''))<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//+''''+','+''''+fill_ghx_ADOQuery.FieldByname('jianyan_cankaozhi').AsString+''''+')';<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:='insert into zhikong(id,DATE,TIME,WBC,KET,NIT,URO,GLU,BIL,PRO,BLD,CR,Ca,MA,shizhitype,zkyh) values('<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit1.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+(Trim(Edit2.Text))+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit3.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit4.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit5.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit6.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit7.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit8.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit9.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit10.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit11.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit12.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit13.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(Edit14.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(cbb1.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+Trim(cbb2.Text)+''''+','<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+''''+')';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(strsql);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Memo1.Text:=strsql ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Close;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SQL.Clear;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SQL.Add(strsql);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[0].Value:=Trim(Edit1.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Parameters[1].Value:=StrToDate(Trim(Edit2.Text));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[1].Value:=Trim(Edit2.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[2].Value:=Trim(Edit3.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[3].Value:=Trim(Edit4.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[4].Value:=Trim(Edit5.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[5].Value:=Trim(Edit6.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[6].Value:=Trim(Edit7.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[7].Value:=Trim(Edit8.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[8].Value:=Trim(Edit9.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[9].Value:=Trim(Edit10.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[10].Value:=Trim(Edit11.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[11].Value:=Trim(Edit12.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[12].Value:=Trim(Edit13.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[13].Value:=Trim(Edit14.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[14].Value:=Trim(cbb1.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Parameters[15].Value:=Trim(cbb2.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('fffffffffffff');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('gggggggggggggggg');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; execsql;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('hhhhhhhhhhhhhhhhh');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// showmessage('不能写入质控表,请和系统管理员联系。;!');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on e: Exception do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; errMsg := e.Message;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp;;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//query data into dbgrid<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:='';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:='select id,DATE,TIME,WBC,KET,NIT,URO,GLU,BIL,PRO,BLD,CR,Ca,MA,shizhitype,zkyh' +char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'from zhikong' +char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;close;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sql.Clear ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sql.Add(strsql);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Open;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DBGrid1.Columns[0].FieldName:='id';<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[1].FieldName:='DATE';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[2].FieldName:='TIME';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[3].FieldName:='WBC';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[4].FieldName:='KET';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[5].FieldName:='NIT';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[6].FieldName:='URO';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[7].FieldName:='GLU';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[8].FieldName:='BIL';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[9].FieldName:='PRO';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[10].FieldName:='BLD';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[11].FieldName:='CR';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[12].FieldName:='Ca';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[13].FieldName:='shizhitype';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBGrid1.Columns[14].FieldName:='zkyh';<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;except<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('不能查询质控表,请和系统管理员联系。;!');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp;;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br><br>end;<br><br><br>project glht.exe raised execption class EOleException with <br>message 'INSERT NTO 语句的语法错误。'<br>process stopped .use step or run to continue.<br><br>我跟踪了,没有说明错误啊
 
少了个values,格式如下:<br>insert into tablename (volumename) values (value)
 
不是很明白,请说明点,可否?????
 
我的代码,我简化了下<br>procedure TzhikongjieshouForm.BitBtn2Click(Sender: TObject);<br>var<br>&nbsp; &nbsp; &nbsp;QRYTMP:TADOQUERY;<br>&nbsp; &nbsp; &nbsp;DS:TDataSource ;<br>&nbsp; &nbsp; &nbsp; strsql,errmsg:string;<br>&nbsp; &nbsp; &nbsp;<br>begin<br><br><br>&nbsp; &nbsp; &nbsp; &nbsp;try &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QryTmp:=TADOQuery.Create(self);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; qrytmp.Connection:=MyDataModule.ADOConn ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DS:=TDataSource.Create(SELF);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DS.DataSet:=qrytmp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dbgrid1.DataSource:=DS;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('cant CONNECT THE MyDataModule.ADOConn ;!');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp;;<br><br>&nbsp; &nbsp; &nbsp; with QryTmp do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:='';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:='insert into zhikong(id,DATE,TIME,WBC,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'KET,NIT,URO,GLU,BIL,PRO,BLD,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'CR,Ca,MA,shizhitype,zkyh)'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;STRSQL:=STRSQL+'values(:id,:DATE,:TIME,:WBC,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;STRSQL:=STRSQL+':KET,:NIT,:URO,:GLU,:BIL,:PRO,:BLD,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;STRSQL:=STRSQL+':CR,:Ca,:MA,:shizhitype,:zkyh)'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Close;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SQL.Clear;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SQL.Add(strsql);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[0].Value:=Trim(Edit1.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[1].Value:=Trim(Edit2.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[2].Value:=Trim(Edit3.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[3].Value:=Trim(Edit4.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[4].Value:=Trim(Edit5.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[5].Value:=Trim(Edit6.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[6].Value:=Trim(Edit7.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[7].Value:=Trim(Edit8.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[8].Value:=Trim(Edit9.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[9].Value:=Trim(Edit10.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[10].Value:=Trim(Edit11.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[11].Value:=Trim(Edit12.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[12].Value:=Trim(Edit13.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[13].Value:=Trim(Edit14.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[14].Value:=Trim(cbb1.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Parameters[15].Value:=Trim(cbb2.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; execsql;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on e: Exception do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; errMsg := e.Message;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp;;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br><br>end;<br><br>project glht.exe raised execption class EOleException with <br>message 'INSERT NTO 语句的语法错误。'<br>process stopped .use step or run to continue.
 
strsql:='insert into zhikong(id,TIME,WBC,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'KET,NIT,URO,GLU,BIL,PRO,BLD,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'CR,Ca,MA,shizhitype,zkyh)'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql :=strsql+' &nbsp; &nbsp; &nbsp; &nbsp; valuse(:id,:TIME,:WBC,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+':KET,:NIT,:URO,:GLU,:BIL,:PRO,:BLD,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+':CR,:Ca,:MA,:shizhitype,:zkyh)'+char(13);<br>//这里有一个valuse拼写错误
 
我仔细核对了,没有错误啊,你看到哪个错误了请指出可否?
 
我从来不喜欢用参数,这样比较难对,我多是用字符串,如果有这样的问题,我通常把 Sql 打印出来,直接放到数据库里去运行的。
 
strsql:='insert into zhikong(id,TIME,WBC,'+CHAR(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'KET,NIT,URO,GLU,BIL,PRO,BLD,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+'CR,Ca,MA,shizhitype,zkyh)'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql :=strsql+' &nbsp; &nbsp; &nbsp; &nbsp; [red]valuse[/red](:id,:TIME,:WBC,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+':KET,:NIT,:URO,:GLU,:BIL,:PRO,:BLD,'+char(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strsql:=strsql+':CR,:Ca,:MA,:shizhitype,:zkyh)'+char(13);
 
对access插入操作最好不真接用insert into<br>而用 adoquery.new;
 
DATE,TIME<br>这些是SQL语句的关键字/保留字,要用方括号包起来<br>[DATE],[TIME]
 
接受答案了.
 
后退
顶部