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();
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]" +
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]" +
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