I started developing ASP.NET web applications about three weeks ago. I was doing perfectly with sql databases and all the server controls but when I tried to access an Access database, I got this wierd error, something to the effect of:
"The database file (database file path and name) cannot be opened. Either another user is connected or you need permsission to view its data" - then there is a reference to System.Data.OleDb.OleDbException..
I have searched high and low for information about this error and all I have found is in the book "ASP.NET programming with C#" by Wrox. The book talks about this kind of thing being a common issue with Access databases and you can fix it by adding a new user and setting the WRITE permission to checked (or on). I tried this but the book is talking about iis 5.0 and I have iis 5.1 (what difference this makes I don't know) Anyway, I still get the error and any addition of the WRITE permission does not effect anything that I need it too. Help... Its driving me crazy.
Comments
BTW, the connexion string just the same as it was in Classic ASP when you connected thru the Oledb driver. However, now that ASP.NET is object-oriented, you have to import the right modules before even attempting to do practically anything useful.
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>
Sub Page_Load()
Set up our connection string and display on the page
Dim strConnection as String = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConnection += "Data Source=C:BegASPNETch12Northwind.mdb"
data_src.text = strConnection
Dim objConnection as New OledbConnection(strConnection)
Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.
"
objConnection.Close()
con_close.text="Connection closed.
"
catch e as Exception
con_open.text="Connection failed to open.
"
con_close.text=e.ToString()
end try
end Sub
Testing the data connection
: I started developing ASP.NET web applications about three weeks ago. I was doing perfectly with sql databases and all the server controls but when I tried to access an Access database, I got this wierd error, something to the effect of:
: "The database file (database file path and name) cannot be opened. Either another user is connected or you need permsission to view its data" - then there is a reference to System.Data.OleDb.OleDbException..
: I have searched high and low for information about this error and all I have found is in the book "ASP.NET programming with C#" by Wrox. The book talks about this kind of thing being a common issue with Access databases and you can fix it by adding a new user and setting the WRITE permission to checked (or on). I tried this but the book is talking about iis 5.0 and I have iis 5.1 (what difference this makes I don't know) Anyway, I still get the error and any addition of the WRITE permission does not effect anything that I need it too. Help... Its driving me crazy.
:
[hr][grey]To err is human, but to really foul things up requires a computer. (Farmers Almanac)[/grey] :-)