J
jesseyzy
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TzhikongjieshouForm.BitBtn2Click(Sender: TObject);<br>var<br> QRYTMP:TADOQUERY;<br> DS:TDataSource ;<br> strsql,errmsg:string;<br> <br>begin<br><br><br> try //<br> //如果在fromshow的事件里面创建qrytmp的话,在做第二次查询的时候<br> //就回提示field jx的字段不存在。<br><br> QryTmp:=TADOQuery.Create(self);<br> qrytmp.Connection:=MyDataModule.ADOConn ;<br> DS:=TDataSource.Create(SELF);<br> DS.DataSet:=qrytmp;<br> dbgrid1.DataSource:=DS;<br><br> except<br> showmessage('cant CONNECT THE MyDataModule.ADOConn ;!');<br> end ;<br><br> with QryTmp do<br> begin<br> strsql:='';<br> { strsql:='insert into zhikong(id,DATE,TIME,WBC,'+CHAR(13);<br> strsql:=strsql+'KET,NIT,URO,GLU,BIL,PRO,BLD,'+CHAR(13);<br> strsql:=strsql+'CR,Ca,MA,shizhitype,zkyh)'+CHAR(13);<br> STRSQL:=STRSQL+'valuesid,ATE,:TIME,:WBC,'+CHAR(13);<br> STRSQL:=STRSQL+':KET,:NIT,:URO,:GLU,:BIL,RO,:BLD,'+CHAR(13);<br> STRSQL:=STRSQL+':CR,:Ca,:MA,:shizhitype,:zkyh)'+CHAR(13);<br> }<br> strsql:='insert into zhikong(id,TIME,WBC,'+CHAR(13);<br> strsql:=strsql+'KET,NIT,URO,GLU,BIL,PRO,BLD,'+char(13);<br> strsql:=strsql+'CR,Ca,MA,shizhitype,zkyh)'+char(13);<br> strsql :=strsql+' valuseid,:TIME,:WBC,'+char(13);<br> strsql:=strsql+':KET,:NIT,:URO,:GLU,:BIL,RO,:BLD,'+char(13);<br> strsql:=strsql+':CR,:Ca,:MA,:shizhitype,:zkyh)'+char(13);<br><br> // showmessage(strsql);<br> //sqlStr:='insert into jianyan_temp(jianyan_yingwen,jianyan_mincheng,temp,jianyan_cankaozhi) values('<br> //+''''+updatetempADOQuery.Fields.FieldName+''''+','<br> //+''''+'*'+fill_ghx_ADOQuery.FieldByname('jianyan_zhongwen').AsString<br> //+'('+updatetempADOQuery.Fields.FieldName+')'+''''+','+''''<br> //+ trim(AnsiReplaceText(updatetempADOQuery.Fields.AsString,'*',''))<br> //+''''+','+''''+fill_ghx_ADOQuery.FieldByname('jianyan_cankaozhi').AsString+''''+')';<br><br> {<br> strsql:='insert into zhikong(id,DATE,TIME,WBC,KET,NIT,URO,GLU,BIL,PRO,BLD,CR,Ca,MA,shizhitype,zkyh) values('<br> +''''+Trim(Edit1.Text)+''''+','<br> +''''+(Trim(Edit2.Text))+''''+','<br> +''''+Trim(Edit3.Text)+''''+','<br> +''''+Trim(Edit4.Text)+''''+','<br> +''''+Trim(Edit5.Text)+''''+','<br> +''''+Trim(Edit6.Text)+''''+','<br> +''''+Trim(Edit7.Text)+''''+','<br> +''''+Trim(Edit8.Text)+''''+','<br> +''''+Trim(Edit9.Text)+''''+','<br> +''''+Trim(Edit10.Text)+''''+','<br> +''''+Trim(Edit11.Text)+''''+','<br> +''''+Trim(Edit12.Text)+''''+','<br> +''''+Trim(Edit13.Text)+''''+','<br> +''''+Trim(Edit14.Text)+''''+','<br> +''''+Trim(cbb1.Text)+''''+','<br> +''''+Trim(cbb2.Text)+''''+','<br> +''''+')';<br> }<br> showmessage(strsql);<br> Memo1.Text:=strsql ;<br> // exit;<br> Close;<br> SQL.Clear;<br> SQL.Add(strsql);<br> Parameters[0].Value:=Trim(Edit1.Text);<br> //Parameters[1].Value:=StrToDate(Trim(Edit2.Text));<br> Parameters[1].Value:=Trim(Edit2.Text);<br> Parameters[2].Value:=Trim(Edit3.Text);<br> Parameters[3].Value:=Trim(Edit4.Text);<br> Parameters[4].Value:=Trim(Edit5.Text);<br> Parameters[5].Value:=Trim(Edit6.Text);<br> Parameters[6].Value:=Trim(Edit7.Text);<br> Parameters[7].Value:=Trim(Edit8.Text);<br> Parameters[8].Value:=Trim(Edit9.Text);<br> Parameters[9].Value:=Trim(Edit10.Text);<br> Parameters[10].Value:=Trim(Edit11.Text);<br> Parameters[11].Value:=Trim(Edit12.Text);<br> Parameters[12].Value:=Trim(Edit13.Text);<br> Parameters[13].Value:=Trim(Edit14.Text);<br> Parameters[14].Value:=Trim(cbb1.Text);<br> //Parameters[15].Value:=Trim(cbb2.Text);<br> showmessage('fffffffffffff');<br> try<br> showmessage('gggggggggggggggg');<br> execsql;<br> showmessage('hhhhhhhhhhhhhhhhh');<br> except<br> // showmessage('不能写入质控表,请和系统管理员联系。;!');<br> on e: Exception do<br> errMsg := e.Message;<br> end ;<br> //query data into dbgrid<br> try<br> strsql:='';<br> strsql:='select id,DATE,TIME,WBC,KET,NIT,URO,GLU,BIL,PRO,BLD,CR,Ca,MA,shizhitype,zkyh' +char(13);<br> strsql:=strsql+'from zhikong' +char(13);<br> close;<br> sql.Clear ;<br> sql.Add(strsql);<br> Open;<br> DBGrid1.Columns[0].FieldName:='id';<br><br> DBGrid1.Columns[1].FieldName:='DATE';<br> DBGrid1.Columns[2].FieldName:='TIME';<br> DBGrid1.Columns[3].FieldName:='WBC';<br> DBGrid1.Columns[4].FieldName:='KET';<br> DBGrid1.Columns[5].FieldName:='NIT';<br> DBGrid1.Columns[6].FieldName:='URO';<br> DBGrid1.Columns[7].FieldName:='GLU';<br> DBGrid1.Columns[8].FieldName:='BIL';<br> DBGrid1.Columns[9].FieldName:='PRO';<br> DBGrid1.Columns[10].FieldName:='BLD';<br> DBGrid1.Columns[11].FieldName:='CR';<br> DBGrid1.Columns[12].FieldName:='Ca';<br> DBGrid1.Columns[13].FieldName:='shizhitype';<br> DBGrid1.Columns[14].FieldName:='zkyh';<br><br> except<br> showmessage('不能查询质控表,请和系统管理员联系。;!');<br> end ;<br> <br> end;<br> <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>我跟踪了,没有说明错误啊