ASP.NET and Access

I am trying to update a page that is currently working in regular ASP to ASP.NET and I keep getting the following error:<BR><BR>[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file &#039x:members.mdb&#039. It is already opened exclusively by another user, or you need permission to view its data<BR><BR>The database is unencrypted and doesn&#039t require a username or password. I have lowered both the share permissions and the NTFS permissions to Full Control for both this folder and it&#039s contents and I still get the error. I do not get this error if I execute the same script against SQL server. I have even created a front end to the database on the webserver and tried accessing the back end that way and I still get the error. Is this a beta version bug or is there something else I could be missing?Typically this error mean that the mcb file is locked because another user accessed it. Occassionally Access will (because of caching) lock for a short period of time. This is one reason Access is not recommended for web apps.<BR><BR>Can you post your code so we can see if there is something wrong?<BR><BR>Thanks,<BR>Doug Seven<BR>CodeJunkies.Net / ASPNextGen.comHere is the working ASP code:<BR><BR><%<BR>Dim adoConnection &#039As ADODB.Connection<BR>Dim adoRecordset &#039As ADODB.Recordset<BR>Dim strQuery &#039As String<BR><BR>strQuery = "Select * From tblTest"<BR><BR>Set adoConnection = Server.CreateObject("ADODB.Connection")<BR>adoConnection.Open "Test" &#039DSN<BR><BR>Set adoRecordset = Server.CreateObject ("ADODB.Recordset")<BR>adoRecordset.Open strQuery, adoConnection, adOpenStatic, adLockReadOnly<BR><BR>Do While NOT adoRecordset.EOF<BR><BR> Response.Write(adoRecordset("t_FirstName") & " " & adoRecordset("t_LastName") _<BR> & " " & adoRecordset("t_Age") & "<BR>")<BR> adoRecordset.MoveNext<BR><BR>Loop<BR><BR>%><BR><BR>Here is the non-working ASP.NET code:<BR><%<BR>Dim adoConnection &#039As ADODB.Connection<BR>Dim adoRecordset &#039As ADODB.Recordset<BR>Dim strQuery As String<BR><BR>strQuery = "Select * From tblTest"<BR><BR>adoConnection = Server.CreateObject("ADODB.Connection")<BR>adoConnection.Open ("NewSertoma")<BR><BR>adoRecordset = Server.CreateObject ("ADODB.Recordset")<BR>adoRecordset.Open (strQuery, adoConnection, adOpenStatic, adLockReadOnly)<BR><BR>Do While NOT adoRecordset.EOF<BR><BR> Response.Write(adoRecordset("t_FirstName").Value & " " & adoRecordset("t_LastName").Value _<BR> & " " & adoRecordset("t_Age").Value & "<BR>")<BR> adoRecordset.MoveNext<BR><BR>Loop<BR><BR>%><BR><BR>As you can see there are minimal changes between the working ASP and the non-working ASP.NET. I have tried both DSN and DSN-less connections. This is a test application run on a test database accessed only by myself, so others aren&#039t locking it. It is however located on a share on another computer. (Necessary for testing as this will be a deployment possibility) I have been able to get the code to work fine with SQL server, but not Access. For my current needs, this must work under Access. As I stated in the previous post, permissions are set at full control for everyone for both sharing and NTFS permissions for this folder and this database.<BR><BR>The scripts work fine with a local Access database.
 
Back
Top