unit PasProductData;interfaceuses
controls,Dialogs,Forms,dbtables,Sysutils,classes,Db,ComObj,
Windows,Variants, ShellApi, IniFiles, Activex, AdoDB;
var
ProductQry: TADOQuery;
ProductCnt: TADOConnection; procedure ExportProductData ;implementationuses PasPublic; //readinifile在PasPublic里procedure ExportProductData ;
var
strFileName,StoreName:string;
sd: TSaveDialog;
begin
CoInitialize(nil);
ProductQry:=TADOQuery.Create(nil);
ProductQry.ConnectionString:= ReadIniFile('DBSet.ini');
with ProductQry do
begin
close;
sql.Text:='select top 1 StoreName from CurrentStore';
open;
StoreName:=FieldByName('StoreName').AsString;
close;
end;
ProductCnt:=TADOConnection.Create(Application);
ProductCnt.ConnectionString:=ReadIniFile('DBSet.ini');
ProductCnt.LoginPrompt:=false;
ProductCnt.Connected:=true; strFileName:=ExtractFilePath(Application.EXEName);
sd := TSaveDialog.Create(Application);
try
sd.Options:=sd.Options+[OfOverwritePrompt];
sd.InitialDir := strFileName+'Backup\';
sd.DefaultExt:='MDB';
sd.FileName := StoreName;//ExtractFilePath(Application.EXEName)+strFileName;
sd.Filter := 'ACCESS 数据库(*.MDB)|*.MDB';
if Not sd.Execute then exit;
ProductCnt.Execute('select * into [D:\ProModel.mdb].ProductList From ProductList'); // 执行到此处就出错
application.MessageBox('数据库备份成功!','提示',MB_OK+MB_ICONINFORMATION);}
finally
FreeAndNil(sd);
FreeAndNil(ProductQry);
FreeAndNil(ProductCnt);
CoUninitialize();
end;
end;end.
------------
总是搞不明白怎样才可以在两个Access之间导入导出数据到其中的表。
controls,Dialogs,Forms,dbtables,Sysutils,classes,Db,ComObj,
Windows,Variants, ShellApi, IniFiles, Activex, AdoDB;
var
ProductQry: TADOQuery;
ProductCnt: TADOConnection; procedure ExportProductData ;implementationuses PasPublic; //readinifile在PasPublic里procedure ExportProductData ;
var
strFileName,StoreName:string;
sd: TSaveDialog;
begin
CoInitialize(nil);
ProductQry:=TADOQuery.Create(nil);
ProductQry.ConnectionString:= ReadIniFile('DBSet.ini');
with ProductQry do
begin
close;
sql.Text:='select top 1 StoreName from CurrentStore';
open;
StoreName:=FieldByName('StoreName').AsString;
close;
end;
ProductCnt:=TADOConnection.Create(Application);
ProductCnt.ConnectionString:=ReadIniFile('DBSet.ini');
ProductCnt.LoginPrompt:=false;
ProductCnt.Connected:=true; strFileName:=ExtractFilePath(Application.EXEName);
sd := TSaveDialog.Create(Application);
try
sd.Options:=sd.Options+[OfOverwritePrompt];
sd.InitialDir := strFileName+'Backup\';
sd.DefaultExt:='MDB';
sd.FileName := StoreName;//ExtractFilePath(Application.EXEName)+strFileName;
sd.Filter := 'ACCESS 数据库(*.MDB)|*.MDB';
if Not sd.Execute then exit;
ProductCnt.Execute('select * into [D:\ProModel.mdb].ProductList From ProductList'); // 执行到此处就出错
application.MessageBox('数据库备份成功!','提示',MB_OK+MB_ICONINFORMATION);}
finally
FreeAndNil(sd);
FreeAndNil(ProductQry);
FreeAndNil(ProductCnt);
CoUninitialize();
end;
end;end.
------------
总是搞不明白怎样才可以在两个Access之间导入导出数据到其中的表。
解决方案 »
- 如何去除字段的空格
- 这个STRING会结果显示什么 ?
- 用FastReport能设计个exe让外部程序调用吗?
- 如何通过socket.sendbuff和socket.receivebuff发送和接收一个结构体?
- 请求版主增加图片功能,因为我们大家没有图片好多事情说不清的,支持我的就发贴。
- 巨难问题,高手近来看看,谈谈高见吧,解决了得200分,不食言 200410
- 高分求一Sql语句,分不够另开帖!
- 有谁能帮我解决一下这个问题,我感激不尽!!!
- 多张图片紧挨着放在一行让它在屏幕上滚动,一行滚动完之后再循环回来的时候,每张图片在屏幕最左端都出现延迟,这如何处理,请大家帮忙,
- 用ghost克隆时出现下面错误是怎么回事!!!!
- 请问:关于获得类似http://www.xxx.com/a.gif的文件内容
- DbGridEh怎么设奇偶行的颜色不一样呢.......
ProductCnt.Execute('Insert into [D:\ProModel.mdb].ProductList Select * From ProductList');
adoquery1.sql.text:='insert into 表 select * from ProductList in "D:\ProModel.mdb" '