debbierich22
Programmer
I have a page that registers users on my website. Once they have entered information into textboxes and clicked the submit button, they are redirected to a generic page that contains only HTML to say they have successfully registered.
I am using a DSN to connect to an Access database, and I know this is configured correctly because the transaction will succeed one time. I have included code to close the connection but when I navigate to any other page in my website that has a database connection, I receive an error on the line where I open the new connection to the same database. The error is either "Unspecified Error" or "Microsoft OLEDB error:file is already in use." This happens throughout my site and I am using the same method to close the connection throughout (which I think is my problem.)
Check out the example below:
When I return to this same page, I cannot access the database. If I close the browser and relaunch the browser, this does not resolve the problem. Re-starting the entire computer seems to be the only solution. HELP!
I am using a DSN to connect to an Access database, and I know this is configured correctly because the transaction will succeed one time. I have included code to close the connection but when I navigate to any other page in my website that has a database connection, I receive an error on the line where I open the new connection to the same database. The error is either "Unspecified Error" or "Microsoft OLEDB error:file is already in use." This happens throughout my site and I am using the same method to close the connection throughout (which I think is my problem.)
Check out the example below:
Code:
<%
dim Uname,Pword,Email,Name
Uname = Request("Username")
Pword = Request("Password")
Email = Request("Email")
Name = Request("Name")
IF Uname <> "" AND Pword <> "" AND Email<> "" AND Name <> "" THEN
'Connect to database
Dim Conne, sourceDSN, strSQL, Results
sourceDSN="utilreport"
Set Conne = Server.CreateObject("ADODB.Connection")
Conne.Open sourceDSN
strSQL = "INSERT INTO Users(User_Id,Password,Name,Email) VALUES('" + Uname + "','" + Pword + "','" + Name + "','" + Email + "')"
Conne.Execute(strSQL)
Conne.Close
Set Conne = Nothing
Response.redirect("registersuccess.asp")
END IF
%>
<h1>Registration</h1>
<form method=post action="register.asp">
<br>
<TABLE>
<TR valign=top>
<TD><h3>Username:</h3></TD>
<TD><INPUT MAXLENGTH=20 NAME="Username" SIZE=25></TD>
</TR>
<TR valign=top>
<TD><h3>Password:</h3></TD>
<TD><INPUT type=password MAXLENGTH=20 NAME="Password" SIZE=25></TD>
</TR>
<TR valign=top>
<TD><h3>Name:</h3></TD>
<TD><INPUT MAXLENGTH=20 NAME="Name" SIZE=25></TD>
</TR>
<TR valign=top>
<TD><h3>E-Mail Address:</h3></TD>
<TD><INPUT MAXLENGTH=50 NAME="Email" SIZE=50></TD>
</TR>
<TR valign=top>
<TD colspan=2><center><h3>* All fields are required.</h3><center></TD>
</TR>
<TR valign=top>
<TD colspan=2><center><INPUT Type=Submit NAME="Submit" Value="Submit"></center></TD>
</TR>
</TABLE>
</form>
When I return to this same page, I cannot access the database. If I close the browser and relaunch the browser, this does not resolve the problem. Re-starting the entire computer seems to be the only solution. HELP!