从下面代码可以看出:where 名称: 说明'名称'不能修改,怎改成'名称'也可以修改?
table 编号,名称,品类,单位价格,货位
try
with adoquery do
begin
close;
sql.Clear;
sql.Add('update bhb set 编号=:bh,品类=:pl,单位价格=:dwjg,货位=:hw where 名称=:mc');
Parameters.ParamByName('mc').Value:=trim(edit1.Text);
Parameters.ParamByName('bh').Value:=trim(edit2.Text);
Parameters.ParamByName('pl').Value:=trim(edit3.Text);
Parameters.ParamByName('dwjg').Value:=trim(edit4.Text);
Parameters.ParamByName('hw').Value:=trim(edit5.Text);
execsql;
showmessage('修改成功!');end;
except
showmessage('修改失败!');
end;
table 编号,名称,品类,单位价格,货位
try
with adoquery do
begin
close;
sql.Clear;
sql.Add('update bhb set 编号=:bh,品类=:pl,单位价格=:dwjg,货位=:hw where 名称=:mc');
Parameters.ParamByName('mc').Value:=trim(edit1.Text);
Parameters.ParamByName('bh').Value:=trim(edit2.Text);
Parameters.ParamByName('pl').Value:=trim(edit3.Text);
Parameters.ParamByName('dwjg').Value:=trim(edit4.Text);
Parameters.ParamByName('hw').Value:=trim(edit5.Text);
execsql;
showmessage('修改成功!');end;
except
showmessage('修改失败!');
end;
解决方案 »
- “Access violation at address 74BD19A0” 咨询下74BD19A0这个什么意思?
- 急求!!!
- 如何获取dll中按钮的click事件
- 安装delphi7出项的问题,请大家帮忙看看是什么原因?
- 如何实现sql脚本文件的操作?
- 有人做过PDF417码,交流一下经验?
- 哪个大哥能帮我弄个简单的数据访问程序啊?
- 有关数据库的小问题..
- 关于opc的一个问题—怎样自动查找节点设备?
- 50!!50分!!请高手赐教:我的MDI Application,如何每次只显示一个ChildForm?
- 怎样得到文件复制操作时的时间?
- 请问,在delphi 中关于向数据库中增加记录的问题?
s:string;
beginwith adoquery do
begin
s:=Fields[1].AsString;
close;
sql.Clear;
sql.Add(format('update bhb set 名称=''%s'',编号=''%s'',品类=''%s'',单位价格=%f,货位=''%s'' where 名称=''%s''',
[trim(clmcedit.Text),
trim(bhedit.Text),
trim(pledit.Text),
StrToFloat(dwjgedit.Text),
trim(hwedit.Text),s
]));
execsql;
end;
try
with adoquery do
begin
close;
sql.Clear;
sql.Add('update bhb set 名称=:mc2,编号=:bh,品类=:pl,单位价格=:dwjg,货位=:hw where 名称=:mc');
Parameters.ParamByName('mc').Value:=trim(edit1.Text);
Parameters.ParamByName('mc2').Value:=trim(edit1.Text);
Parameters.ParamByName('bh').Value:=trim(edit2.Text);
Parameters.ParamByName('pl').Value:=trim(edit3.Text);
Parameters.ParamByName('dwjg').Value:=trim(edit4.Text);
Parameters.ParamByName('hw').Value:=trim(edit5.Text);
execsql;
showmessage('修改成功!'); end;
except
showmessage('修改失败!');
end;
例如你输入edit1
输入.
会显示edit1的属性出来!,但不会
with adoquery do
begin
close;
sql.Clear;
sql.Add('update bhb set 名称=:mc2,编号=:bh,品类=:pl,单位价格=:dwjg,货位=:hw where 名称=:mc');
Parameters.ParamByName('mc').Value:=trim(edit1.Text);
Parameters.ParamByName('mc2').Value:=trim(edit1.Text);
Parameters.ParamByName('bh').Value:=trim(edit2.Text);
Parameters.ParamByName('pl').Value:=trim(edit3.Text);
Parameters.ParamByName('dwjg').Value:=trim(edit4.Text);
Parameters.ParamByName('hw').Value:=trim(edit5.Text);
execsql;
showmessage('修改成功!'); end;
except
showmessage('修改失败!');
end;
try
with adoquery do
begin
close;
sql.Clear;
sql.Add('update bhb set 名称=:mc2,编号=:bh,品类=:pl,单位价格=:dwjg,货位=:hw where 名称=:mc');
Parameters.ParamByName('mc').Value:=trim(edit1.Text);
Parameters.ParamByName('mc2').Value:=trim(clmcedit.Text);//这里改一下
Parameters.ParamByName('bh').Value:=trim(edit2.Text);
Parameters.ParamByName('pl').Value:=trim(edit3.Text);
Parameters.ParamByName('dwjg').Value:=trim(edit4.Text);
Parameters.ParamByName('hw').Value:=trim(edit5.Text);
execsql;
showmessage('修改成功!'); end;
except
showmessage('修改失败!');
end;
没有这个控件呀?
假如有,那还不是一样?
Parameters.ParamByName('mc2').Value:=trim(clmcedit.Text);//这里是修改后的值