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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error handling when connecting to DB 1

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi,

I've got a login form that has a username, password and database password. The database password is required to look up the main username and password. The problem I've got is I don't know how to say "If connection to the password is OK then do one thing else do another" so far I've got:

The database is in Access 2003 and I've put a password on it.

Thanks very much

Ed

<%
On Error Resume Next

Username=Request.Form("username")
Password=Request.Form("password")
DBPassword=Request.Form("dbpassword")

Set DB = Server.CreateObject("ADODB.Connection")
Set TBL = Server.CreateObject("ADODB.RecordSet")

DB.Mode = adModeReadWrite
DB.Open "bwbnetpriv",, DBPassword

Set TBL=Nothing
Set DB=Nothing
%>
 
Start by trying something like this: [tt]

[..]

DB.Mode = adModeReadWrite
DB.Open "bwbnetpriv",, DBPassword

If err.Number <> 0 Then
Response.Write "Something bad happened."
Response.End
End If

If DB.State <> 1 Then
Response.Write "DB Connection not open."
Response.End
End If
[..]

[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top