with rqADOQuery do
begin
sql.Clear;
sql.Add('update '+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+' set 栋号= :栋号,房号= :房号,姓名= :姓名,类型= :类型,面积= :面积,单价= :单价 where 房号= :房号 and 栋号= :栋号');
parameters.ParamValues['栋号'] := Edit5.Text;
parameters.ParamValues['房号'] := Edit6.Text;
parameters.ParamValues['姓名'] := Edit7.Text;
parameters.ParamValues['类型'] := Edit8.Text;
parameters.ParamValues['面积'] := Edit9.Text;
parameters.ParamValues['单价'] := Edit10.Text;
sql.Add('update '+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+' set 月应收费用=面积*单价');
//execsql;
open;
end;我想更新数据表里面的数据为外部程序的值 这个表的名字是combobox的当前值 但是当我用execsql时 程序不出错 就是不更新数据 用open 提示 rqADOQuery: commandtext does not return a result set 请问如何写才对
begin
sql.Clear;
sql.Add('update '+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+' set 栋号= :栋号,房号= :房号,姓名= :姓名,类型= :类型,面积= :面积,单价= :单价 where 房号= :房号 and 栋号= :栋号');
parameters.ParamValues['栋号'] := Edit5.Text;
parameters.ParamValues['房号'] := Edit6.Text;
parameters.ParamValues['姓名'] := Edit7.Text;
parameters.ParamValues['类型'] := Edit8.Text;
parameters.ParamValues['面积'] := Edit9.Text;
parameters.ParamValues['单价'] := Edit10.Text;
sql.Add('update '+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+' set 月应收费用=面积*单价');
//execsql;
open;
end;我想更新数据表里面的数据为外部程序的值 这个表的名字是combobox的当前值 但是当我用execsql时 程序不出错 就是不更新数据 用open 提示 rqADOQuery: commandtext does not return a result set 请问如何写才对
execsql;//少了这个吧
sql.clear;
sql.Add('update '+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+' set 月应收费用=面积*单价');
execsql;
sql.Add('update '+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+' set 月应收费用=面积*单价'); {在程序中增加下面这句话}
sql.Add('Select * From ' +ComboBox1.Items.Strings[ComboBox1.ItemIndex] ); //execsql;
open;
我象那样试了 不起作用 应该不是结果集的问题wlbfeihu(下辈子还写程序)兄:
我这段的参数好像也没有重名 无解。郁闷中