Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with .ldb file staying open in ASP page

Status
Not open for further replies.

utahjzz98

Programmer
Jan 9, 2003
69
US
Greetings,

I have an .asp page where I connect to a Access database on the back end. It's a pretty basic login page, that post back to itself and allows the admin to save information to the db as well.

My problem is this...I can use the admin page once and save data to the db just fine. However, when I attempt to go back at a later time, I get the following error.

**************************************************
Microsoft JET Database Engine error '80004005'

Could not use ''; file already in use.

/admin.asp, line 61
**************************************************

Now I am positive this isn't a permissions issue, because I can save the data the first time, I just can't go back and do it at a later time. The only thing I can think of is the .ldb file is not being closed on the web server after the information is saved. The thing that really baffles me is that all the development was done on my local machine and the program works perfectly. However, when I upload it to my web server I begin to see this error. Does anybody have advice on how I could fix this? I have listed my code below...

Thanks in advance,
Corey

Code:
<HTML>
<HEAD>
<title>Login</title>
</HEAD>
<BODY>
<%
Dim strAction, strUpdate, strRedirect

strAction = Request.Form("cmdLogin")
strUpdate = Request.QueryString("Update")
strRedirect = Request.QueryString("Redirect")


%>
</BODY>
</HTML>

<%Select Case strAction
	Case ""
		If strUpdate = "True" Then
			Call DisplayMemberInfo()
		Else
			Call DisplayLogin
		End If
	Case "Login"
		Call CheckLogin()
	Case "Save"
		Call UpdateMemberInfo()
		Call DisplayAdmin()
End Select
Private Function DisplayLogin
%>
<table cellpadding="3" Cellspacing="0">
<form name="frmLogin" method="post" action="admin.asp">
	<tr>
		<td bgcolor="lightsteelblue" align="center"><b>Login</b></td>
	</tr>
	<tr bgcolor="gainsboro">
		<td>User Name<br><input type="text" name="txtUserName"></td>
	</tr>
	<tr bgcolor="gainsboro">
		<td>Password<br><input type="password" name="txtPassword"></td>
	</tr>
	<tr bgcolor="gainsboro">
		<td align="Center"><input type="submit" name="cmdLogin" value="Login"></td>
	</tr>
</form>
</table>
<%
End Function

Private Function DisplayAdmin

	Dim objConn, objRS, strConn, strSQL, strClass
		
	Set objConn = Server.CreateObject("ADODB.Connection")
	Set objRS = Server.CreateObject("ADODB.Recordset")
	strConn = Application("ConnectionString")
	strSQL = "SELECT * FROM Member ORDER BY Name"
	
	objConn.Open strConn
	objRS.Open strSQL, objConn
	
	Response.Write "<table cellpadding='3' cellspacing='0' width='500'>"
	Response.Write "	<tr bgcolor='lightsteelblue'>"
	Response.Write "		<td><b>Name</b></td>"
	Response.Write "		<td><b>Level</b></td>"
	Response.Write "		<td><b>AA</b></td>"
	Response.Write "		<td><b>DKP</b></td>"
	Response.Write "		<td><b>Rank</b></td>"
	Response.Write "	</tr>"
	While not objRS.EOF
		Response.Write "<tr>"
		Response.Write "	<td><a href='admin.asp?Update=True&MemberID=" & objRS("MemberID") & "'>" & objRS("Name") & "</a></td>"
		Response.Write "	<td>" & objRS("Level") & "</td>"
		Response.Write "	<td>" & objRS("AA") & "</td>"
		Response.Write "	<td>" & objRS("DKP") & "</td>"
		Response.Write "	<td>" & objRS("Rank") & "</td>"
		Response.Write "</tr>"
		objRS.MoveNext
	Wend
	Response.Write "</table>"
			
	objRS.Close
	objConn.Close
	Set objRS = Nothing
	Set objConn = Nothing

End Function
Private Function CheckLogin()
	Dim objConn, objRS, strConn, strSQL, strUserName, strPassword
		
	Set objConn = Server.CreateObject("ADODB.Connection")
	Set objRS = Server.CreateObject("ADODB.Recordset")
	strConn = Application("ConnectionString")
	strUserName = Request.Form("txtUserName")
	strPassword = Request.Form("txtPassword")
	strSQL = "SELECT * FROM Login WHERE UserName='" & strUserName & "' AND Password='" & strPassword & "'"

	objConn.Open strConn
	objRS.Open strSQL, objConn

	If objRS.EOF = true Then
		Response.Write "Incorrect User Name or Password"
		Response.Write "<br>"
		Response.Write "Click <a href='javascript:history.back(1)'>here</a> to go back"
	Else
		Call DisplayAdmin()
	End If
	
	objRS.Close
	objConn.Close
	Set objRS = Nothing
	Set objConn = Nothing
End Function
Private Function DisplayMemberInfo
	Dim objConn, objRS, strConn, strSQL, intMemberID
		
	Set objConn = Server.CreateObject("ADODB.Connection")
	Set objRS = Server.CreateObject("ADODB.Recordset")
	strConn = Application("ConnectionString")
	intMemberID = Request.QueryString("MemberID")
	strSQL = "SELECT * FROM Member WHERE MemberID=" & intMemberID

	objConn.Open strConn
	objRS.Open strSQL, objConn
	
	Response.Write "<table cellpadding='3' cellspacing='0' width='500'>"
	Response.Write "<form name='frmMemberInfo' method='post' action='admin.asp'>"
	Response.Write "	<tr bgcolor='lightsteelblue'>"
	Response.Write "		<td><b>Name</b></td>"
	Response.Write "		<td><b>Level</b></td>"
	Response.Write "		<td><b>AA</b></td>"
	Response.Write "		<td><b>DKP</b></td>"
	Response.Write "		<td><b>Rank</b></td>"
	Response.Write "	</tr>"
	Response.Write "	<tr>"
	Response.Write "	<td><input type='text' name='txtName' value='" & ObjRS("Name") & "'></td>"
	Response.Write "	<td><input type='text' name='txtLevel' value='" & objRS("Level") & "'></td>"
	Response.Write "	<td><input type='text' name='txtAA' value='" & objRS("AA") & "'></td>"
	Response.Write "	<td><input type='text' name='txtDKP' value='" & objRS("DKP") & "'></td>"
	Response.Write "	<td><input type='text' name='txtRank' value='" & objRS("Rank") & "'></td>"
	Response.Write "	</tr>"
	Response.Write "	<tr>"
	Response.Write "		<td colspan='5' align='center'><input type='submit' name='cmdLogin' value='Save'></td>"
	Response.Write "		<td><input type='hidden' name='MemberID' value='" & objRS("MemberID") & "'>"
	Response.Write "	</tr>"
	Response.Write "</form>"
	Response.Write "</table>"
	
	objRS.close
	objConn.close
	Set objRS = Nothing
	Set objConn = Nothing
End Function
Private Function UpdateMemberInfo()
	Dim objConn, strConn, strSQL
	Dim strName, strLevel, strAA, intDKP, strRank, intMemberID
	
	strName = Trim(Request.Form("txtName"))
	strLevel = Request.Form("txtLevel")
	strAA = Request.Form("txtAA")
	intDKP = Request.Form("txtDKP")
	strRank = Trim(Request.Form("txtRank"))
	intMemberID = Request.Form("MemberID")
	
	Set objConn = Server.CreateObject("ADODB.Connection")
		
	strConn = Application("ConnectionString")
	strSQL = "UPDATE [Member] SET [Name]='" & strName & "', "
	strSQL = strSQL & "[Level]=" & strLevel & ", "
	strSQL = strSQL & "[AA]=" & strAA & ", "
	strSQL = strSQL & "[DKP]=" & intDKP & ", "
	strSQL = strSQL & "[Rank]='" & strRank & "' "
	strSQL = strSQL & "WHERE [MemberID]=" & intMemberID
	
	objConn.Open strConn
	objConn.execute strSQL
	
	objConn.close
	Set objConn = Nothing
End Function
%>
[code]
 
what permissions does the IUSR account on the DB directory? Write permission might not be enough. It may need Delete permission to get rid of the LDB file.

just a thought.


Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Thanks for your reply FesterSXS. Originally, I was convinced that this error was due to permissions, so I gave the anon IUSR account full permissions to the .mdb file to. I receive the same error regardless of whether IUSR has read/write or full permissions.
 
Wow, I never even thought about that. It's working perfectly now, thank you so much for your help. I really appreciate it!

Regards,
Corey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top