MS SQL后台,要求把数据导出备份到 .txt 文件中,并能从 .txt 文件导入到数据库中,
请大家帮忙,实现后立方即结帐。
请大家帮忙,实现后立方即结帐。
解决方案 »
- ctrl+F查询框使用问题
- tdbadvgrid怎么样隐藏表对呀?
- IdUDPServer有接收事件,IdUDPClient为何没有接收事件?它怎样接收数据呢?
- MDI主窗体上放的东西一直显示到最上面怎么办
- 难题:activex控件上传用户端文件到服务器!
- pchar(201)是什么意思?不好意思,有点简单
- 大家进来看看,散分!!!!
- ado连接为什么这么慢?
- 一个初学者的问题!!
- 各位前辈,请教关于用树形结构保存用户权限设置及根据控制菜单和工具条的问题。总分100分
- 哪里有TopGrid 2.20(ProfGrid 2.20) for Delphi 7控件下载??
- 越干越没意思,原来写应用程序,现在要写驱动了。
ADOCommand.Execute() ;//备分
ADOCommand.CommandText:='RESTORE database ** FROM DISK = 'd:\test.bak';
ADOCommand.Execute() ;//恢复
后面参数可以不加!
如何在程序里实现DTS和bcp?请赐教.
备份出来要求是.txt文件。
ADOCommand.Execute() ;//备分
ADOCommand.CommandText:='RESTORE database ** FROM DISK = 'd:\test.txt;
ADOCommand.Execute() ;//恢复
后面参数可以不加!
Textlist:=Tstringlist.create;
if opendialog1.Execute then
begin
Textlist.LoadFromFile(opendialog1.filename);
LineNo:=1;
while LineNo<TextList.Count do
begin
LineStr:=Textlist[LineNo];
adotable1.InsertRecord([copy(linestr,1,6),copy(linestr,7,7),copy(linestr,11,11)]);
Inc(LineNo);
end;
end;
TextList.Free;
end;
导出:bcp 数据库名.dbo.表名 out 文件名 -c -S服务器名或IP -U用户名 -P口令
导入:bcp 数据库名.dbo.表名 in 文件名 -c -S服务器名或IP -U用户名 -P口令
注意一定要加上 -c,它表示以字符形式导入或导出。
http://www.51delphi.com/delphi/download?num=59 : Delphi 6;
http://www.51delphi.com/delphi/download?num=167 : Delphi 7
他不仅可以将数据导入和导出,而且还可导成Excell、Html、txt等格式呢!!!
祝君好运!!!