我已经把view1导出到了1.sql,怎么用Adoquery导入到数据库?
我的数据库是SQL 2K
我的数据库是SQL 2K
解决方案 »
- delphi 7的中 TIdTCPClient组件ReadLn超时不能用怎么解决?
- 用程序如何實現直接打開某個WINDOWS文件夾
- 高分求教组件开发的问题!
- delphi+oracle的数据查询问题!(高分)
- vb delphi vc++ java mysql sql server oracle
- 请教大家一个在Delphi中面向对象编程的一个 初级问题!!!
- 如何解决项目移到其它地方后不能正常运行?
- 使用TRegistry要有啥前提吗?我怎么编译不通过阿?
- 我安装了Flash控件,怎么使窗口在一段swf播放完后关闭?
- Kingron(WinAPI)老兄,救救我!
- 老问题有没有新方法?
- 关于frxreport1导出数据的问题 求教!!!!!!!!!
adoquery1.sql.clear;
adoquery1.LoadFromFile(1.txt);
adoquery1.execsql;
错误2: CREATE 必须放前面
s:string;
sqltext : string;
sqlfile : TextFile;
begin
if OpenDialog1.Execute then
begin
AssignFile(sqlfile, OpenDialog1.FileName);
FileMode := 0;
Reset(sqlfile);
try
ADOConnection1.BeginTrans;
while not eof(sqlfile) do
begin
Readln(sqlfile, s);
sqltext:=s;
while (not eof(sqlfile)) and
(uppercase(trim(s))<>'GO') do
begin
Readln(sqlfile, s);
if (uppercase(trim(s))<>'GO') then
sqltext:=sqltext+' '+s;
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sqltext);
adoquery1.ExecSQL;
end;
//如果文件是UNICODE编码的话,则会乱码。
var
s:string;
sqltext : string;
sqlfile : TextFile;
begin
if OpenDialog1.Execute then
begin
AssignFile(sqlfile, OpenDialog1.FileName);
FileMode := 0;
Reset(sqlfile);
try
ADOConnection1.BeginTrans;
while not eof(sqlfile) do
begin
Readln(sqlfile, s);
sqltext:=s;
while (not eof(sqlfile)) and
(uppercase(trim(s))<>'GO') do
begin
Readln(sqlfile, s);
if (uppercase(trim(s))<>'GO') then
sqltext:=sqltext+' '+s;
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sqltext);
adoquery1.ExecSQL;
end;
CloseFile(sqlfile);
ADOConnection1.CommitTrans;
application.MessageBox('SQL角本完成!',
'提示',MB_OK+MB_ICONINFORMATION);
except
raise exception.Create('SQL角本执行失败!');
ADOConnection1.RollbackTrans;
end;
end;
end;
其中:ADOConnection1,adoquery1,OpenDialog1都是窗口中放置的控件。可以将之设为局部变量,在本函数内创建和消毁。