从一个Access DB导入到另一个Access DB [英] Importing from one Access DB to another Access DB

查看:94
本文介绍了从一个Access DB导入到另一个Access DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

这就是我所拥有的.我有没有密码的查询.

Hello

This is what I have. I have a query that works without a password.

OleDbConnection objConnection = null;
OleDbCommand objCmd = null;
String strConnection
strConnection = (@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\AccessDB1.mdb");
objConnection = new OleDbConnection(strConnection);
objConnection.ConnectionString = strConnection;
objConnection.Open();

strInsertSQL = ("Insert into Main(" +
                "ID, " +
                "ItemNum, " +
                "DataType, " +
                "Data, " +
                "Tesxt) ") +
                "SELECT " +
                "ID, " +
                "ItemNum, " +
                "DataType, " +
                "Data, " +
                "Tesxt " +
                " FROM [MS Access; database=c:\\AccessDB2.mdb;].[tblMain]" +
                " where Tesxt in (1,2,3,4)" +
                " order by ID";
            objCmd = new OleDbCommand(strInsertSQL, objConnection);
            
            objCmd.ExecuteNonQuery();
            objConnection.Close();



现在,我尝试在密码保护的情况下连接到AccessDB2.密码是qwerty123.
我已经试过了



Now I''m trying to connect to AccessDB2 when its password protected. The password is qwerty123.
I''ve tried this

" FROM [MS Access; database=c:\\AccessDB2.mdb;Password=qwerty123].[tblMain]" +


这没用. Visual Studio 2010出错并说不是有效的密码",这怎么可能?这是我打开AccessDB2时输入到Access中的密码.

我已经试过了


This didn''t work. Visual Studio 2010 errored out and said "Not a Valid Password" How is this possible?? It is the password that I put in to Access when I open AccessDB2.

I''ve tried this

" FROM [MS Access; database=c:\\AccessDB2.mdb;Jet OLEDB:Database Password=qwerty123].[tblMain]" +


这也不起作用.

我已经试过了


This didn''t work either.

I''ve tried this

" FROM [Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\AccessDB2.mdb;Jet OLEDB:Database Password=qwerty123].[tblMain]" +


这也不起作用

我已经尝试了所有变化.为什么我可以不使用密码即可连接到AccessDB2,然后尝试使用密码时却无法执行插入操作.有谁知道为什么或有解决方案吗?

这是另一个问题.还有另一种方法可以用另一种方式做完全相同的事情吗?

Thanks


This didn''t work either

I''ve tried every variation on this. Why is it that I can connect to AccessDB2 without a password and then when I try to use a password I''m not able to do the insert. Does anyone know why or have a solution??

Here''s another question. Is there another way to do the exact same thing another way??

Thanks

推荐答案

为什么不将所有数据读入内存,然后从那里插入?

Tesxt

这真的是列名吗?
Why not read all the data in to memory, then insert it from there ?

Tesxt

Is this really a column name ?


这篇关于从一个Access DB导入到另一个Access DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆