我用sql删除语句怎么删除不了数据,并且报告Field stuname not found,我为ADOquery加了afterscroll事件:
edit1.Text:=ADO_info.FieldByName('stunum').AsString;
edit2.Text:=ADO_info.FieldByName('stuname').AsString;
edit3.Text:=ADO_info.FieldByName('stuclass').AsString;
edit4.Text:=ADO_info.FieldByName('stusex').AsString;
其中ado_info是一个ADOQuery,
我的删除语句如下:
s:='delete from stu_info where stunum='''+edit1.text+'''';//根据edit中的数据进行删除
if messagebox(0,'确定要删除数据吗?','删除',MB_OKCANCEL)=1 then
with ADO_info do
begin
close;
sql.clear;
sql.Add('select stunum from stu_info where stunum='+''''+edit1.Text+'''');
open;
if recordcount<>0 then
begin
close;
//ADO_info.Delete;
SQL.Clear;
SQL.Add(s);
// open;
execsql;
close;
sql.clear;
SQL.Add('select stunum,stuname,stuclass,stusex from stu_info');
Open;
end
else
messageDlg('对不起,该记录不存在!',mtinformation,[mbok],0);
end;
大侠们帮帮忙呀,我分不多呀
edit1.Text:=ADO_info.FieldByName('stunum').AsString;
edit2.Text:=ADO_info.FieldByName('stuname').AsString;
edit3.Text:=ADO_info.FieldByName('stuclass').AsString;
edit4.Text:=ADO_info.FieldByName('stusex').AsString;
其中ado_info是一个ADOQuery,
我的删除语句如下:
s:='delete from stu_info where stunum='''+edit1.text+'''';//根据edit中的数据进行删除
if messagebox(0,'确定要删除数据吗?','删除',MB_OKCANCEL)=1 then
with ADO_info do
begin
close;
sql.clear;
sql.Add('select stunum from stu_info where stunum='+''''+edit1.Text+'''');
open;
if recordcount<>0 then
begin
close;
//ADO_info.Delete;
SQL.Clear;
SQL.Add(s);
// open;
execsql;
close;
sql.clear;
SQL.Add('select stunum,stuname,stuclass,stusex from stu_info');
Open;
end
else
messageDlg('对不起,该记录不存在!',mtinformation,[mbok],0);
end;
大侠们帮帮忙呀,我分不多呀
解决方案 »
- DELPHI遍历PE文件
- 面向对象的问题!听下大家现在的情况!
- 在自定义类中出现问题(初学者)
- 快!catastrophic failure
- 有誰用过INSTALLSHIELD3.03?
- 救命!SQL SERVER日志问题!如何限制日志大小,并且能够自动改写老的日志?
- 怎么没有vfp的论坛啊 ??
- sql server 日期检索问题
- 很失望:今天到书市逛了半天,想找一下关于条形码方面的资料,进出的书店不少于四,五十家,毫无收获.到是"淀海考王"之类的书满大街都是.
- 简单问题 -- 为什么自定义事件只触发一次??(20分)
- MDI主窗体的关闭问题
- 在FASTREPORT3.10中如何在预览打印以后自动关闭?
问题在这一句, 不是删除的错误