SQLDataSet中执行DDL语句
时间:2021-07-01 10:21:17
帮助过:22人阅读
TForm3.ExeSQLScript;
var
strScript:string;
strSQL:string;
iPos:integer;
begin
strScript:=
Memo1.Lines.Text;
while Length(strScript)>
0 do
begin
iPos:=Pos(
‘;‘,strScript);
if iPos>
0 then
begin
strSQL:= Copy(strScript,
1,iPos-
1);
SQLDataSet2.CommandText:=
strSQL;
SQLDataset2.ExecSQL(true);
Delete(strScript,1,iPos);
end else
begin
break;
end;
end;
if ClientDataSet1.Active
then
begin
ClientDataSet1.Refresh;
end else
begin
ClientDataSet1.Active:=
true;
end;
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
ExeSQLScript;
end;
能上代码在DELPHI XE5 ,WIN7 X64,ORACLE 11G中测试通过。
SQLDataSet中执行DDL语句
标签:jpg pre form image delete code 新建 lin set