把一个表从一个Access数据库(A库)拷贝到另一个Access数据库中去(B库)。
做法是:
1,在系统DSN中注册A库。
2,Adoquery通过DSN连接A库。
3,Adoquery执行'select * into [B库绝对地址].[GroupName] From GroupName'
问题是:
在Access中可以执行上述的SQL语句,但在程序中出现'EOleException 不正常地定义参数对象,提供了不一致或不完整地信息'的错误。请有经验的高手看看能不能让Adoquery执行这个SQL,如果这条路走不通,还请各位指点迷津
8 个解决方案
#1
怎么没人知道吗?
#2
access->access:
ADOQUERY指向导入MDB:
ADOQUERY:SELECT * INTO QQ FROM ZZ IN 'D:\TEMP\QQW.MDB' 'JET 3.X;'
QQ为新表名
ZZ为导出表名
D:\TEMP\QQW.MDB为导出库名
ADOQUERY指向导入MDB:
ADOQUERY:SELECT * INTO QQ FROM ZZ IN 'D:\TEMP\QQW.MDB' 'JET 3.X;'
QQ为新表名
ZZ为导出表名
D:\TEMP\QQW.MDB为导出库名
#3
学习
#4
我想让导入库名用绝对地址,
SELECT * INTO QQ IN 'D:\TEMP\QQW.MDB' FROM ZZ 'JET 3.X;'
QQ为新表名
ZZ为导出表名
D:\TEMP\QQW.MDB为导入库名
这样行吗?
SELECT * INTO QQ IN 'D:\TEMP\QQW.MDB' FROM ZZ 'JET 3.X;'
QQ为新表名
ZZ为导出表名
D:\TEMP\QQW.MDB为导入库名
这样行吗?
#5
Transact-SQL语句进行导入导出:
1. 在SQL SERVER里查询access数据:
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=')...表名
2. 将access导入SQL server
在SQL SERVER 里运行:
SELECT *
INTO newtable
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=' )...表名
3. 将SQL SERVER表里的数据插入到Access表中
在SQL SERVER 里运行:
insert into OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=" c:\DB.mdb";User ID=Admin;Password=')...表名
(列名1,列名2)
select 列名1,列名2 from sql表
实例:
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\db.mdb';'admin';'', Test)
select id,name from Test
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\trade.mdb'; 'admin'; '', 表名)
SELECT *
FROM sqltablename
1. 在SQL SERVER里查询access数据:
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=')...表名
2. 将access导入SQL server
在SQL SERVER 里运行:
SELECT *
INTO newtable
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=' )...表名
3. 将SQL SERVER表里的数据插入到Access表中
在SQL SERVER 里运行:
insert into OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=" c:\DB.mdb";User ID=Admin;Password=')...表名
(列名1,列名2)
select 列名1,列名2 from sql表
实例:
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\db.mdb';'admin';'', Test)
select id,name from Test
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\trade.mdb'; 'admin'; '', 表名)
SELECT *
FROM sqltablename
#6
要将导出文件的 SQL 语法先说明一下
SELECT Table.Fields INTO [dbms type;DATABASE=path].[unqualified filename] FROM [Table or Tables]
SELECT Table.Fields INTO [资料库种类;DATABASE=资料库路径].[资料库文件名称] FROM [Table or Tables]
SQL 语法:SELECT * INTO [dBase III;DATABASE=资料库路径].[dbase文件名称] FROM [authors]
db.Execute "SELECT * INTO [dBase III;DATABASE=C:\test].[authors.DBF] FROM [authors]"
注意事项:
1、authors.DBF 事先不可存在,否则会产生错误!
2、若您没有 Dbase,您可以使用 Access 来连结这个 Table,以便观察结果!
SELECT Table.Fields INTO [dbms type;DATABASE=path].[unqualified filename] FROM [Table or Tables]
SELECT Table.Fields INTO [资料库种类;DATABASE=资料库路径].[资料库文件名称] FROM [Table or Tables]
SQL 语法:SELECT * INTO [dBase III;DATABASE=资料库路径].[dbase文件名称] FROM [authors]
db.Execute "SELECT * INTO [dBase III;DATABASE=C:\test].[authors.DBF] FROM [authors]"
注意事项:
1、authors.DBF 事先不可存在,否则会产生错误!
2、若您没有 Dbase,您可以使用 Access 来连结这个 Table,以便观察结果!
#7
Access 文件
SQL 语法:SELECT * INTO [新资料库路径+文件名][新资料表名称] FROM [authors]
'导出到同一资料库 ( 新 Table 为 authors1 )
'新 Table authors1 事先不可存在,否则会产生错误!
db.Execute "SELECT * INTO [authors1] FROM [authors]"
'导出到不同的资料库 ( 新资料库为 db1,新 Table 为 authors )
'新资料库 db1事先必须存在,否则会产生错误!
'但是其中新 Table authors 事先不可存在,否则会产生错误!
db.Execute "SELECT * INTO [C:\test\db1.mdb].[authors] FROM [authors]"
注一:各种可能的资料库种类 Connect 属性设定方式:
资料库种类 资料库声明方式 资料库路径 (或加上文件名)
Microsoft Jet Database [database]; drive:\path\filename.mdb
dBASE III dBASE III; drive:\path
dBASE IV dBASE IV; drive:\path
dBASE 5 dBASE 5.0; drive:\path
Paradox 3.x Paradox 3.x; drive:\path
Paradox 4.x Paradox 4.x; drive:\path
Paradox 5.x Paradox 5.x; drive:\path
Microsoft FoxPro 2.0 FoxPro 2.0; drive:\path
Microsoft FoxPro 2.5 FoxPro 2.5; drive:\path
Microsoft FoxPro 2.6 FoxPro 2.6; drive:\path
Microsoft Visual FoxPro 3.0 FoxPro 3.0; drive:\path
Microsoft Excel 3.0 Excel 3.0; drive:\path\filename.xls
Microsoft Excel 4.0 Excel 4.0; drive:\path\filename.xls
Microsoft Excel 5.0 or Microsoft Excel 95 Excel 5.0; drive:\path\filename.xls
Microsoft Excel 97 Excel 8.0; drive:\path\filename.xls
Lotus 1-2-3 WKS and WK1 Lotus WK1; drive:\path\filename.wk1
Lotus 1-2-3 WK3 Lotus WK3; drive:\path\filename.wk3
Lotus 1-2-3 WK4 Lotus WK4; drive:\path\filename.wk4
HTML Import HTML Import; drive:\path\filename
HTML Export HTML Export; drive:\path
Text Text; drive:\path
ODBC ODBC;
DATABASE=database;
UID=user;
PWD=password;
DSN= datasourcename;
[LOGINTIMEOUT=seconds;] None
Microsoft Exchange Exchange 4.0;
MAPILEVEL=folderpath; [TABLETYPE={ 0 | 1 }];[PROFILE=profile;]
[PWD=password;]
[DATABASE=database;]
SQL 语法:SELECT * INTO [新资料库路径+文件名][新资料表名称] FROM [authors]
'导出到同一资料库 ( 新 Table 为 authors1 )
'新 Table authors1 事先不可存在,否则会产生错误!
db.Execute "SELECT * INTO [authors1] FROM [authors]"
'导出到不同的资料库 ( 新资料库为 db1,新 Table 为 authors )
'新资料库 db1事先必须存在,否则会产生错误!
'但是其中新 Table authors 事先不可存在,否则会产生错误!
db.Execute "SELECT * INTO [C:\test\db1.mdb].[authors] FROM [authors]"
注一:各种可能的资料库种类 Connect 属性设定方式:
资料库种类 资料库声明方式 资料库路径 (或加上文件名)
Microsoft Jet Database [database]; drive:\path\filename.mdb
dBASE III dBASE III; drive:\path
dBASE IV dBASE IV; drive:\path
dBASE 5 dBASE 5.0; drive:\path
Paradox 3.x Paradox 3.x; drive:\path
Paradox 4.x Paradox 4.x; drive:\path
Paradox 5.x Paradox 5.x; drive:\path
Microsoft FoxPro 2.0 FoxPro 2.0; drive:\path
Microsoft FoxPro 2.5 FoxPro 2.5; drive:\path
Microsoft FoxPro 2.6 FoxPro 2.6; drive:\path
Microsoft Visual FoxPro 3.0 FoxPro 3.0; drive:\path
Microsoft Excel 3.0 Excel 3.0; drive:\path\filename.xls
Microsoft Excel 4.0 Excel 4.0; drive:\path\filename.xls
Microsoft Excel 5.0 or Microsoft Excel 95 Excel 5.0; drive:\path\filename.xls
Microsoft Excel 97 Excel 8.0; drive:\path\filename.xls
Lotus 1-2-3 WKS and WK1 Lotus WK1; drive:\path\filename.wk1
Lotus 1-2-3 WK3 Lotus WK3; drive:\path\filename.wk3
Lotus 1-2-3 WK4 Lotus WK4; drive:\path\filename.wk4
HTML Import HTML Import; drive:\path\filename
HTML Export HTML Export; drive:\path
Text Text; drive:\path
ODBC ODBC;
DATABASE=database;
UID=user;
PWD=password;
DSN= datasourcename;
[LOGINTIMEOUT=seconds;] None
Microsoft Exchange Exchange 4.0;
MAPILEVEL=folderpath; [TABLETYPE={ 0 | 1 }];[PROFILE=profile;]
[PWD=password;]
[DATABASE=database;]
#8
楼上的,那我的代码那里错了呢?
with Adoquery1 do
begin
close;
sql.Clear;
str:='select *['+GetCurrentDir+clientFilesDir+'\'+votedb.mdb+'].groupname]' From GroupName ';
sql.Append(str );
open;
end;
with Adoquery1 do
begin
close;
sql.Clear;
str:='select *['+GetCurrentDir+clientFilesDir+'\'+votedb.mdb+'].groupname]' From GroupName ';
sql.Append(str );
open;
end;
#1
怎么没人知道吗?
#2
access->access:
ADOQUERY指向导入MDB:
ADOQUERY:SELECT * INTO QQ FROM ZZ IN 'D:\TEMP\QQW.MDB' 'JET 3.X;'
QQ为新表名
ZZ为导出表名
D:\TEMP\QQW.MDB为导出库名
ADOQUERY指向导入MDB:
ADOQUERY:SELECT * INTO QQ FROM ZZ IN 'D:\TEMP\QQW.MDB' 'JET 3.X;'
QQ为新表名
ZZ为导出表名
D:\TEMP\QQW.MDB为导出库名
#3
学习
#4
我想让导入库名用绝对地址,
SELECT * INTO QQ IN 'D:\TEMP\QQW.MDB' FROM ZZ 'JET 3.X;'
QQ为新表名
ZZ为导出表名
D:\TEMP\QQW.MDB为导入库名
这样行吗?
SELECT * INTO QQ IN 'D:\TEMP\QQW.MDB' FROM ZZ 'JET 3.X;'
QQ为新表名
ZZ为导出表名
D:\TEMP\QQW.MDB为导入库名
这样行吗?
#5
Transact-SQL语句进行导入导出:
1. 在SQL SERVER里查询access数据:
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=')...表名
2. 将access导入SQL server
在SQL SERVER 里运行:
SELECT *
INTO newtable
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=' )...表名
3. 将SQL SERVER表里的数据插入到Access表中
在SQL SERVER 里运行:
insert into OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=" c:\DB.mdb";User ID=Admin;Password=')...表名
(列名1,列名2)
select 列名1,列名2 from sql表
实例:
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\db.mdb';'admin';'', Test)
select id,name from Test
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\trade.mdb'; 'admin'; '', 表名)
SELECT *
FROM sqltablename
1. 在SQL SERVER里查询access数据:
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=')...表名
2. 将access导入SQL server
在SQL SERVER 里运行:
SELECT *
INTO newtable
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=' )...表名
3. 将SQL SERVER表里的数据插入到Access表中
在SQL SERVER 里运行:
insert into OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=" c:\DB.mdb";User ID=Admin;Password=')...表名
(列名1,列名2)
select 列名1,列名2 from sql表
实例:
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\db.mdb';'admin';'', Test)
select id,name from Test
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\trade.mdb'; 'admin'; '', 表名)
SELECT *
FROM sqltablename
#6
要将导出文件的 SQL 语法先说明一下
SELECT Table.Fields INTO [dbms type;DATABASE=path].[unqualified filename] FROM [Table or Tables]
SELECT Table.Fields INTO [资料库种类;DATABASE=资料库路径].[资料库文件名称] FROM [Table or Tables]
SQL 语法:SELECT * INTO [dBase III;DATABASE=资料库路径].[dbase文件名称] FROM [authors]
db.Execute "SELECT * INTO [dBase III;DATABASE=C:\test].[authors.DBF] FROM [authors]"
注意事项:
1、authors.DBF 事先不可存在,否则会产生错误!
2、若您没有 Dbase,您可以使用 Access 来连结这个 Table,以便观察结果!
SELECT Table.Fields INTO [dbms type;DATABASE=path].[unqualified filename] FROM [Table or Tables]
SELECT Table.Fields INTO [资料库种类;DATABASE=资料库路径].[资料库文件名称] FROM [Table or Tables]
SQL 语法:SELECT * INTO [dBase III;DATABASE=资料库路径].[dbase文件名称] FROM [authors]
db.Execute "SELECT * INTO [dBase III;DATABASE=C:\test].[authors.DBF] FROM [authors]"
注意事项:
1、authors.DBF 事先不可存在,否则会产生错误!
2、若您没有 Dbase,您可以使用 Access 来连结这个 Table,以便观察结果!
#7
Access 文件
SQL 语法:SELECT * INTO [新资料库路径+文件名][新资料表名称] FROM [authors]
'导出到同一资料库 ( 新 Table 为 authors1 )
'新 Table authors1 事先不可存在,否则会产生错误!
db.Execute "SELECT * INTO [authors1] FROM [authors]"
'导出到不同的资料库 ( 新资料库为 db1,新 Table 为 authors )
'新资料库 db1事先必须存在,否则会产生错误!
'但是其中新 Table authors 事先不可存在,否则会产生错误!
db.Execute "SELECT * INTO [C:\test\db1.mdb].[authors] FROM [authors]"
注一:各种可能的资料库种类 Connect 属性设定方式:
资料库种类 资料库声明方式 资料库路径 (或加上文件名)
Microsoft Jet Database [database]; drive:\path\filename.mdb
dBASE III dBASE III; drive:\path
dBASE IV dBASE IV; drive:\path
dBASE 5 dBASE 5.0; drive:\path
Paradox 3.x Paradox 3.x; drive:\path
Paradox 4.x Paradox 4.x; drive:\path
Paradox 5.x Paradox 5.x; drive:\path
Microsoft FoxPro 2.0 FoxPro 2.0; drive:\path
Microsoft FoxPro 2.5 FoxPro 2.5; drive:\path
Microsoft FoxPro 2.6 FoxPro 2.6; drive:\path
Microsoft Visual FoxPro 3.0 FoxPro 3.0; drive:\path
Microsoft Excel 3.0 Excel 3.0; drive:\path\filename.xls
Microsoft Excel 4.0 Excel 4.0; drive:\path\filename.xls
Microsoft Excel 5.0 or Microsoft Excel 95 Excel 5.0; drive:\path\filename.xls
Microsoft Excel 97 Excel 8.0; drive:\path\filename.xls
Lotus 1-2-3 WKS and WK1 Lotus WK1; drive:\path\filename.wk1
Lotus 1-2-3 WK3 Lotus WK3; drive:\path\filename.wk3
Lotus 1-2-3 WK4 Lotus WK4; drive:\path\filename.wk4
HTML Import HTML Import; drive:\path\filename
HTML Export HTML Export; drive:\path
Text Text; drive:\path
ODBC ODBC;
DATABASE=database;
UID=user;
PWD=password;
DSN= datasourcename;
[LOGINTIMEOUT=seconds;] None
Microsoft Exchange Exchange 4.0;
MAPILEVEL=folderpath; [TABLETYPE={ 0 | 1 }];[PROFILE=profile;]
[PWD=password;]
[DATABASE=database;]
SQL 语法:SELECT * INTO [新资料库路径+文件名][新资料表名称] FROM [authors]
'导出到同一资料库 ( 新 Table 为 authors1 )
'新 Table authors1 事先不可存在,否则会产生错误!
db.Execute "SELECT * INTO [authors1] FROM [authors]"
'导出到不同的资料库 ( 新资料库为 db1,新 Table 为 authors )
'新资料库 db1事先必须存在,否则会产生错误!
'但是其中新 Table authors 事先不可存在,否则会产生错误!
db.Execute "SELECT * INTO [C:\test\db1.mdb].[authors] FROM [authors]"
注一:各种可能的资料库种类 Connect 属性设定方式:
资料库种类 资料库声明方式 资料库路径 (或加上文件名)
Microsoft Jet Database [database]; drive:\path\filename.mdb
dBASE III dBASE III; drive:\path
dBASE IV dBASE IV; drive:\path
dBASE 5 dBASE 5.0; drive:\path
Paradox 3.x Paradox 3.x; drive:\path
Paradox 4.x Paradox 4.x; drive:\path
Paradox 5.x Paradox 5.x; drive:\path
Microsoft FoxPro 2.0 FoxPro 2.0; drive:\path
Microsoft FoxPro 2.5 FoxPro 2.5; drive:\path
Microsoft FoxPro 2.6 FoxPro 2.6; drive:\path
Microsoft Visual FoxPro 3.0 FoxPro 3.0; drive:\path
Microsoft Excel 3.0 Excel 3.0; drive:\path\filename.xls
Microsoft Excel 4.0 Excel 4.0; drive:\path\filename.xls
Microsoft Excel 5.0 or Microsoft Excel 95 Excel 5.0; drive:\path\filename.xls
Microsoft Excel 97 Excel 8.0; drive:\path\filename.xls
Lotus 1-2-3 WKS and WK1 Lotus WK1; drive:\path\filename.wk1
Lotus 1-2-3 WK3 Lotus WK3; drive:\path\filename.wk3
Lotus 1-2-3 WK4 Lotus WK4; drive:\path\filename.wk4
HTML Import HTML Import; drive:\path\filename
HTML Export HTML Export; drive:\path
Text Text; drive:\path
ODBC ODBC;
DATABASE=database;
UID=user;
PWD=password;
DSN= datasourcename;
[LOGINTIMEOUT=seconds;] None
Microsoft Exchange Exchange 4.0;
MAPILEVEL=folderpath; [TABLETYPE={ 0 | 1 }];[PROFILE=profile;]
[PWD=password;]
[DATABASE=database;]
#8
楼上的,那我的代码那里错了呢?
with Adoquery1 do
begin
close;
sql.Clear;
str:='select *['+GetCurrentDir+clientFilesDir+'\'+votedb.mdb+'].groupname]' From GroupName ';
sql.Append(str );
open;
end;
with Adoquery1 do
begin
close;
sql.Clear;
str:='select *['+GetCurrentDir+clientFilesDir+'\'+votedb.mdb+'].groupname]' From GroupName ';
sql.Append(str );
open;
end;