哈哈,你可以这样 a := strtoint(edit23.Text); b := strtoint(edit24.Text); c := strtoint(edit25.Text); d := strtoint(edit26.Text); e := strtoint(edit27.Text); query1.sql.add('update jg_hlqs set yy_shouru=a,dj_shouru=b,keping=c,fapai=d,qt_kaoping=e '); 如果是字符型,别忘''''
query1.close; query1.sql.Clear ; query1.sql.add('update jg_hlqs set yy_shouru='+edit23.Text+',dj_shouru='+edit24.Text+',keping='+edit25.Text+',fapai='+edit26.Text+',qt_kaoping='+edit27.Text); query1.sql.add('where bumen='''+combobox4.text+''''); query1.EXECSQL;错误提示: Gereral Sql error. [Microsoft][ODBC Microsoft Access Driver] too few parameters.expected 1. 急待解决
还有两行: query1.ApplyUpdates ; query1.CommitUpdates ;to cszhz(丑小鸭): 错误提示: Gereral Sql error. [Microsoft][ODBC Microsoft Access Driver] too few parameters.expected 1.
给你一个例子: with UpdateQuery do begin Close; SQL.Clear; SQL.ADD('update Table set field=:P1 where Field2=:P2'); Parameters.ParamByName('P1').Value:=Edit1.Text; Parameters.ParamByName('P2').Value:=Edit2.Text; ExecSQL; end; 你的语句用上面方法套用就行了,给分
query1.sql.add('update jg_hlqs set yy_shouru='+edit23.Text+',dj_shouru='+edit24.Text+',keping='+edit25.Text+',fapai='+edit26.Text+',qt_kaoping='+edit27.Text); query1.sql.add(' where bumen='''+combobox4.text+'''');注意:where 前面的空格 教你个好方法,string sql = 'update jg_hlqs set yy_shouru='+edit23.Text+',dj_shouru='+edit24.Text+',keping='+edit25.Text+',fapai='+edit26.Text+',qt_kaoping='+edit27.Text + ' where bumen='''+combobox4.text+''''ShowMessage(sql);先看一看,要执行的sql 是什么,一目了然,错误很容易找到。
看一下你的sql语句,同意jeaking(空空) 的观点,你的sql有问题。
to yyb2000(三流编程机器): 不好意思- UpdateQuery是什麽
query1.sql.add('update jg_hlqs set yy_shouru='+edit23.Text+',dj_shouru='+edit24.Text+',keping='+edit25.Text+',fapai='+edit26.Text+',qt_kaoping='+edit27.Text); query1.sql.add(' where bumen='''+combobox4.text+'''');注意:where 前面的空格 教你个好方法,string sql = 'update jg_hlqs set yy_shouru='+edit23.Text+',dj_shouru='+edit24.Text+',keping='+edit25.Text+',fapai='+edit26.Text+',qt_kaoping='+edit27.Text + ' where bumen='''+combobox4.text+''''ShowMessage(sql);先看一看,要执行的sql 是什么,一目了然,错误很容易找到。
我试了,where 前面的空格 但还是 错误提示: Gereral Sql error. [Microsoft][ODBC Microsoft Access Driver] too few parameters.expected 1.
'update jg_hlqs set yy_shouru=' + edit23.Text + ' ,dj_shouru=' + edit24.Text + ',keping=' + edit25.Text + ',fapai=' + edit26.Text + ',qt_kaoping= ' + edit27.Text'
update jg_hlqs set yy_shouru=1,... 这样的,所以你的语句应该这么写:
query1.sql.add('update jg_hlqs set yy_shouru='+edit23.Text
+',dj_shouru='+edit24.Text+',keping='+edit25.Text
+',fapai='+edit26.Text'+',qt_kaoping='+edit27.Text ');
query1.sql.add('where bumen='''+combobox4.text+'''');
query1.sql.add('update jg_hlqs set yy_shouru='+ edit23.Text +',dj_shouru='+
edit24.Text + ',keping='+edit25.Text + ',fapai='+
edit26.Text+',qt_kaoping='+ edit27.Text);
a := strtoint(edit23.Text);
b := strtoint(edit24.Text);
c := strtoint(edit25.Text);
d := strtoint(edit26.Text);
e := strtoint(edit27.Text);
query1.sql.add('update jg_hlqs set yy_shouru=a,dj_shouru=b,keping=c,fapai=d,qt_kaoping=e ');
如果是字符型,别忘''''
query1.sql.Clear ;
query1.sql.add('update jg_hlqs set yy_shouru='+edit23.Text+',dj_shouru='+edit24.Text+',keping='+edit25.Text+',fapai='+edit26.Text+',qt_kaoping='+edit27.Text);
query1.sql.add('where bumen='''+combobox4.text+'''');
query1.EXECSQL;错误提示:
Gereral Sql error.
[Microsoft][ODBC Microsoft Access Driver] too few parameters.expected 1.
急待解决
query1.ApplyUpdates ;
query1.CommitUpdates ;to cszhz(丑小鸭):
错误提示:
Gereral Sql error.
[Microsoft][ODBC Microsoft Access Driver] too few parameters.expected 1.
with UpdateQuery do begin
Close;
SQL.Clear;
SQL.ADD('update Table set field=:P1 where Field2=:P2');
Parameters.ParamByName('P1').Value:=Edit1.Text;
Parameters.ParamByName('P2').Value:=Edit2.Text;
ExecSQL;
end;
你的语句用上面方法套用就行了,给分
query1.sql.add(' where bumen='''+combobox4.text+'''');注意:where 前面的空格
教你个好方法,string sql = 'update jg_hlqs set yy_shouru='+edit23.Text+',dj_shouru='+edit24.Text+',keping='+edit25.Text+',fapai='+edit26.Text+',qt_kaoping='+edit27.Text + ' where bumen='''+combobox4.text+''''ShowMessage(sql);先看一看,要执行的sql 是什么,一目了然,错误很容易找到。
不好意思- UpdateQuery是什麽
query1.sql.add(' where bumen='''+combobox4.text+'''');注意:where 前面的空格
教你个好方法,string sql = 'update jg_hlqs set yy_shouru='+edit23.Text+',dj_shouru='+edit24.Text+',keping='+edit25.Text+',fapai='+edit26.Text+',qt_kaoping='+edit27.Text + ' where bumen='''+combobox4.text+''''ShowMessage(sql);先看一看,要执行的sql 是什么,一目了然,错误很容易找到。
但还是
错误提示:
Gereral Sql error.
[Microsoft][ODBC Microsoft Access Driver] too few parameters.expected 1.
按你说的做:
错误提示:
Gereral Sql error.
[Microsoft][ODBC Microsoft Access Driver] too few parameters.expected 6。
原来是expected 1。
query1.sql.Clear ;
query1.SQL.add('select * from zhjzh_hlqs where bumen='''+combobox3.text+'''');
query1.Open;
query1.Edit;
query1.fieldbyname('yy_shouru3').value :=edit12.Text;
query1.fieldbyname('dj_shouru6').value :=edit13.Text;
query1.fieldbyname('tingshi11').value :=edit14.Text;
query1.fieldbyname('anquan12').value :=edit15.Text;
query1.fieldbyname('bz_kaoping13').value :=edit16.Text;
query1.fieldbyname('zhizhen14').value :=edit17.Text;
query1.fieldbyname('jieneng15').value :=edit18.Text;
query1.fieldbyname('qtzhb_kaohe16').value :=edit19.Text;
query1.fieldbyname('hl_butie17').value :=edit20.Text;
query1.fieldbyname('qt18').value :=edit21.Text;
query1.fieldbyname('qt19').value :=edit22.Text;
query1.ApplyUpdates ;
query1.CommitUpdates ;提示:could not find object