procedure TForm1.EmptyDbf(const AName: string);
var
s : string;
begin
s := 'delete from '+ AName ;
with Query1 do
begin
if Active then Active := False;
SQL.Clear;
SQL.Add(s);
query1.Prepared:=true;
ExecSQL;
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
EmptyDbf(dsDbfName.FieldByName('DBFNAME').AsString);
ShowMessage('OK');
end;procedure TForm1.BitBtn3Click(Sender: TObject);
begin
with dsDbfName do
begin
dsdbfname.First;
while not Eof do
begin
EmptyDbf(FieldByName('DBFNAME').AsString);
dsdbfname.Next;
end;
end;
ShowMessage('All Ok');
end;end.
提示如下:
project1.exe raised exception class EDatabaseError with message'SQLConnection property'
required for this operation',process stopped.use step or run to continue.
var
s : string;
begin
s := 'delete from '+ AName ;
with Query1 do
begin
if Active then Active := False;
SQL.Clear;
SQL.Add(s);
query1.Prepared:=true;
ExecSQL;
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
EmptyDbf(dsDbfName.FieldByName('DBFNAME').AsString);
ShowMessage('OK');
end;procedure TForm1.BitBtn3Click(Sender: TObject);
begin
with dsDbfName do
begin
dsdbfname.First;
while not Eof do
begin
EmptyDbf(FieldByName('DBFNAME').AsString);
dsdbfname.Next;
end;
end;
ShowMessage('All Ok');
end;end.
提示如下:
project1.exe raised exception class EDatabaseError with message'SQLConnection property'
required for this operation',process stopped.use step or run to continue.
解决方案 »
- [delphi]bitbtn组件里属性enable什么意思
- 才学delphi三天,实习做项目,请大家帮助!关于数据库查询的。谢谢
- 怎么用DLL完成一个客户端的功能
- 我下面的代码怎么执行不了?memo1里没有结果显示啊
- 目录的简单问题(60分送出)
- 提问:如何在自己写的控件中加入自己写的一个FORM,急,可以加分
- delphi5 安装 fr2.5 出现错误提示 line too long(more than 1023 charactors)
- 谁解决了,400分儿,决不食言
- 急!怎样在动态Tquery中设置时间显示格式?
- Delphi动态弹出菜单是如何响应WM_COMMAND消息的??
- 用友--《固定资产》--《变动单》--不能保存
- 关于导出数据到EXCEL的问题
应该是delete from 表名 where 字段=AName
问题在s := 'delete from '+ AName ;
var
s : string;
begin
s := 'delete from '+ AName ;
with Query1 do
begin
if Active then Active := False;
SQL.Clear;
SQL.Add(s);
showmessage(query1.sql.text);//delete from table1 是对的啊我用的是对的啊
query1.Prepared:=true;
ExecSQL;
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
EmptyDbf(dsDbfName.FieldByName('DBFNAME').AsString);
ShowMessage('OK');
end;procedure TForm1.BitBtn3Click(Sender: TObject);
begin
with dsDbfName do
begin
dsdbfname.First;
while not Eof do
begin
EmptyDbf(FieldByName('DBFNAME').AsString);
dsdbfname.Next;//运行到这里也出错
end;
end;
ShowMessage('All Ok');
end;end.
提示如下:
project1.exe raised exception class EDatabaseError with message'SQLConnection property'
required for this operation',process stopped.use step or run to continue.