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

How to read errors

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
How can I tell what database field is causing this error message? I guess I don't know how to read this

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:


Line 182: dbconn1.open()
Line 183:
Line 184: mycommand.ExecuteNonQuery()
Line 185:
Line 186:dbconn1.close


Source File: E:\Intranet\Mystuff\Mystuff\reports\employee.aspx Line: 184

Stack Trace:


[FormatException: Input string was not in a correct format.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +643
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +206
ASP.employee_aspx.add_user(Object s, EventArgs e) in E:\Intranet\Mystuff\Mystuff\reports\employee.aspx:184
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1263


 
You can't see what field caused the error. :-(
penny1.gif
penny1.gif
 
But you can guess what caused the error:

Input string was not in a correct format

Are you calling a stored proc, or passing in a sql statement? If you're passing a sql statement, are you sure the sql command is correct syntactically? If you're called a stored proc, are you trying to give paramters that are of the wrong data type?

Also, if you want to get a better lead of where exactly the error is occuring, I suggest using try/catch blocks areound ALL your code, and in the catch put this:


Catch err as exception
Throw New Exception("ThePage/TheSub/Function:" &
err.message)

That way, if you get an error like this, when it displays you'll have a way to trace to the exact sub/function where hte eror is occuring and narror the scope you have to trouble shoot.

Jack
 
and if possible, you might want to change your stored procedure or SQL statement adding one field at a time and run the application.
It's boring debugging, but very effective =)
Daren J. Lahey
Just another computer guy...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top