Link to home
Start Free TrialLog in
Avatar of jawahar_prasad
jawahar_prasad

asked on

How to Catch DB connection error in ASP??

How to Catch DB connection error in ASP??
This is the code I am using to connect to MS Excel DB.

Set cnnGetRows = Server.CreateObject("ADODB.Connection")
connExcel="Provider=Microsoft.Jet.OleDb.4.0;Data Source="&(url1)&"; Extended Properties=Excel 8.0;"
cnnGetRows.Open connExcel
set rs=server.CreateObject("adodb.recordset")
mysql="SELECT * FROM project_details"
rs.open mysql,cnnGetRows       <--- I am getting CONNECTION ERROR HERE WHEN THE EXCEL SHEET IS OPENED OR IF THE DATABASE IS NOT DEFINED...

It is showing the usual asp error page and line number, I need to catch this error and display custom message
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi

As already suggested to other users I request you to create Tracefiles. This can be used to sort out any issues that happens in the application. For creating tracefiles you can use the FSO (File System Object) method
asp->excel (connection errors)
sorry, please delete this and previous comments (I was trying to add this thread to my knowledge base) and got confused