Database not found

  • Thread starter Thread starter Miha Markic
  • Start date Start date
M

Miha Markic

Hi Bernardo,

It looks to me like connection is using wrong connection string.
I suggest you to check it with debugger.
 
The following block of code gives me an error.

MultiBD is my class for multiple databases.

connection= MultiBd.GetConnection(DataProviderType.OLEDB);
connection.ConnectionString = MultiBd.GetConnectionString
(1);
comand = connection.CreateCommand();
comand.CommandText = strSelectComand;
comand.CommandTimeout = 30;
adapter = MultiBd.GetDataAdapter(DataProviderType.OLEDB);
adapter.SelectCommand = comand;

connection.Open();
int numberOfRows = adapter.Fill(myDataSet);
connection.Close();

the connection string is as follows:
Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\inetpub\\wwwroot\\tasks\\db\\db.mdb;User
Id=admin;Password=;

The database is there... But VS.NET gives me this error:
Could not find file 'C:\WINDOWS\SYSTEM32\db.mdb'.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and
where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
Could not find file 'C:\WINDOWS\SYSTEM32\db.mdb'.

Source Error:


Line 219:
Line 220: connection.Open();
Line 221: int numberOfRows = adapter.Fill(myDataSet);
Line 222: connection.Close();
Line 223: // }


Source File:
c:\inetpub\wwwroot\tasks\classes\db\dbinteraction.cs
Line: 221

Any help?

Thanx in advance
Bernardo Heynemann
 
I did check and the connection string is for sure the following...
And I tried running the app in my friend´s VS.net and the error was the same
but the directory it tried to access was:
c:\inetpub\wwwroot\tasks\bin\debug\db.mdb

How can the same app try to access the database in two different
locations???

Thanx
Bernardo Heynemann
 
Back
Top