OleDbConnection problem with more than 1 connection

  • Thread starter Sylvain Bissonnette
  • Start date
S

Sylvain Bissonnette

Hi,

I had wrote 2 app in c#.net one Windows Form base and one Web Base and
those 2 connect to a access database and some time I got this error in my
web
base application and I can't figure out what's wrong, I just hit reload and
it's work

Thanks for your time
Sylvain Bissonnette

Server Error in '/WebApplication1' Application.



Cannot open database ''. It may not be a database that your application
recognizes, or the file may be corrupt.

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: Cannot open database
''. It may not be a database that your application recognizes, or the file
may be corrupt.

Source Error:





Line 77: // Open database connection

Line 78: OleDbConnection MyConn = new
OleDbConnection(ConnectionString);

Line 79: MyConn.Open();

Line 80:

Line 81: // Create the data
adapter and execute the query



Source File: C:\Inetpub\wwwroot\WebApplication1\Light.aspx.cs Line: 79

Stack Trace:





[OleDbException (0x80004005): Cannot open database ''. It may not be
a database that your application recognizes, or the file may be corrupt.]

System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20

System.Data.OleDb.OleDbConnection.InitializeProvider() +57

System.Data.OleDb.OleDbConnection.Open() +203

WebApplication1.Light.MyDataGrid_ItemCommand(Object source,
DataGridCommandEventArgs e) in
C:\Inetpub\wwwroot\WebApplication1\Light.aspx.cs:79

System.Web.UI.WebControls.DataGrid.OnItemCommand(DataGridCommandEventArgs
e) +110

System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source,
EventArgs e) +68

System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +26

System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e) +106

System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +26

System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +121

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +115

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33

System.Web.UI.Page.ProcessRequestMain() +1277




Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
 
W

W.G. Ryan eMVP

Yes, it's access. That's a file corruption. You can repair it - over and
over - or replace it with Free MSDE - I'd opt for the latter.

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
Sylvain Bissonnette said:
Hi,

I had wrote 2 app in c#.net one Windows Form base and one Web Base and
those 2 connect to a access database and some time I got this error in my
web
base application and I can't figure out what's wrong, I just hit reload and
it's work

Thanks for your time
Sylvain Bissonnette

Server Error in '/WebApplication1' Application.



Cannot open database ''. It may not be a database that your application
recognizes, or the file may be corrupt.

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: Cannot open database
''. It may not be a database that your application recognizes, or the file
may be corrupt.

Source Error:





Line 77: // Open database connection

Line 78: OleDbConnection MyConn = new
OleDbConnection(ConnectionString);

Line 79: MyConn.Open();

Line 80:

Line 81: // Create the data
adapter and execute the query



Source File: C:\Inetpub\wwwroot\WebApplication1\Light.aspx.cs Line: 79

Stack Trace:





[OleDbException (0x80004005): Cannot open database ''. It may not be
a database that your application recognizes, or the file may be corrupt.]

System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20

System.Data.OleDb.OleDbConnection.InitializeProvider() +57

System.Data.OleDb.OleDbConnection.Open() +203

WebApplication1.Light.MyDataGrid_ItemCommand(Object source,
DataGridCommandEventArgs e) in
C:\Inetpub\wwwroot\WebApplication1\Light.aspx.cs:79

System.Web.UI.WebControls.DataGrid.OnItemCommand(DataGridCommandEventArgs
e) +110

System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source,
EventArgs e) +68

System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +26

System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e) +106

System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +26

System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +121System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String
eventArgument) +115

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33

System.Web.UI.Page.ProcessRequestMain() +1277




Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
 
M

Miha Markic [MVP C#]

Hi Bill,

Just to add a simple check before being sure :) - try opening the mdb file
with Access and see what's up.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top