Connection OleDB failed

I want to connect to an .mdb database, the .mdb is password-protected.\[code\]string connectionString2 = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\****ad\******\*****_viewer.mdb; JET OLEDB:Database Password=*********;";OleDbConnection con2 = new OleDbConnection(connectionString2);con2.Open();\[/code\]I get the following exception:\[quote\] ServerVersion = "con2.ServerVersion" has create a exeption from typ System.InvalidOperationException".\[/quote\]\[code\]using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.Sql;using System.Data.SqlClient;using System.Collections;using System.Xml.Serialization;using System.Net;using System.Text;using System.IO;using System.Xml;using System.Xml.Linq;... if (reader.HasRows) { reader.Read(); computer_idn = reader[0].ToString(); string connectionString2 = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\*****..\****...\*..._viewer.mdb; JET OLEDB:Database Password=********;"; OleDbConnection con2 = new OleDbConnection(connectionString2); con2.Open(); string queryString2 = "SELECT TELIS-ID FROM DATA where UserID = " + hostname + ""; OleDbCommand cmd2 = new OleDbCommand(queryString2, con2); OleDbDataReader reader2 = cmd2.ExecuteReader(); if (reader2.HasRows) { getSoftware(); }....\[/code\]
 
Back
Top