[Javascript] Q on ADO and databases and Errors

Walter Torres walter at torres.ws
Thu Feb 6 21:27:46 CST 2003


I have code that does (almost) everything I need it to around my database...
open, close, query, stored procedures, etc.

What I don't have, and can't find, is how to handle errors.

Every error comes back on the IIS ASP error page. Not what I want!

All the examples I find on the net are in VB! Even the "Professional
JavaScript" book has its examples (for this question) in VB!

Can anyone help?

This is my test case...

// Open Database connection

	// Define DB connection Object,
	// make connection and open database
	var objDataConn = Server.CreateObject("ADODB.Connection")
		objDataConn.Open ("DSN=interfaceDB; UID=userTestX ");


// Check for errors
if ( objDataConn.Errors.Count > 0 )
	Response.Write( "[" + objDataConn.Errors.Count + "]<p>" );

I added the 'X' to the password so it would fail.

The error page came back with...

Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'saX '.
/interface_dev/includes/db_open.asp, line 8

Yes, I know login failed. But how can I capture that so I can query the user
for their correct password?

I have 2 days into this.

Any help would be appreciated.

Thanks

walter




More information about the Javascript mailing list