Select into table in another database that is password protected?

为君一笑 提交于 2019-12-01 07:15:28

问题


In Microsoft Access 2003 and Visual Basic 6 I'm trying to copy a table to another access database that is password protected like this...

Select * INTO table2 IN 'database2.mdb' [;Password=TestPass] From table1

It fails with error : Not a valid password

Does the Select INTO format not accept the password with the mdb, and the password has to be in a connection string? If not, how do you reference a different connection string/database?

thanks


回答1:


How about:

SELECT * INTO Table2 IN '' [MS Access;PWD=TestPass;DATABASE=C:\Docs\database2.mdb]
FROM Table1

These days I would be more inclined to use something like the line below, it gives more control and allows for different back-ends:

SELECT * INTO Table2 FROM [MS Access;PWD=password;DATABASE=C:\Docs\database2.mdb].Table1

You can put any valid connection string between the square brackets.

Reference: http://www.connectionstrings.com/




回答2:


If doesn't work this

SELECT * INTO [;PWD=TestPass;DATABASE=C:\Docs\database2.mdb].table2 FROM table1

Try to add "" like this

SELECT * INTO [";PWD=TestPass;DATABASE=C:\Docs\database2.mdb"].table2 FROM table1

It worked for me (Delphi with jet SQL)



来源:https://stackoverflow.com/questions/3639086/select-into-table-in-another-database-that-is-password-protected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!