Jump to content

How to get SQL server's errors?


Guest Farax

Recommended Posts

I'm writing an asp front-end for database. Basically it's a few text inputs for password, login, server, database name and a text area for the querry. Now when you send the querry to the DB server and it's not correct the regular error page has the description of the error, eg. Syntax error :

"Microsoft OLE DB Provider for SQL Server (0x80040E14)Incorrect syntax near '*'./Testdir/Results.asp, line 13"

Or Missing element(table, column or db)

"Microsoft OLE DB Provider for SQL Server (0x80040E37)Invalid object name 'test2'."

When i used Err.Number, Err.Source and Err.Description(other error properties are nothing)i get always:

Error No: 424Source:Microsoft VBScript - runtime errorMessage:Object required

When i use GetLastError() all properties are set to nothing.Is there any way, to get those error descriptions, because it's a lot easier for the user to understand that he/she wrote SLCT instead of SELECT when a proper error page appears.Btw. I've been using asp for 3 full days now, so it's rather new to me.

Link to comment
Share on other sites

The action lines tend to be the ones that say there was an error on line xxxI often put in code that I comment out after testing that displays the key variables such as the one that has the SQL statement in. That way you can often find what the error is eg

'response.write strSQL
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...