Connecting to an Access 2000 database
Hello,
I have been using the following code successfully to connect to an Access 98 database (? - it is the Northwind database on Microsoft's website and it is pre-2000):
try
{
OleDbConnection oleDbConn = new OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Nwind.mdb; ");
oleDbConn.Open();
OleDbDataAdapter dAdapt = new OleDbDataAdapter("SELECT ContactName FROM Customers", oleDbConn);
DataSet ds = new DataSet("Customers");
dAdapt.Fill(ds, "Customers");
return ds;
}
catch(Exception e)
{
Console.WriteLine("" + e.Message);
}
For some reason if I convert the database to Access 2000, this code no longer works. When I invoke the web service no data is collected and it complains that the database is locked exclusively by another user (which is not true) or that I don't have permission to view the data.
I have tried adding the parameters:
User ID=Admin; Password=
in the connection string but this does not help.
I am running Windows XP Pro, and using MS Visual C# .NET.
Any help or suggestions are very much appreciated!
Thanks,
Jonny
|