Re: FormatException & Data.SqlClient.SqlCommand
- From: "Ali Raza Shaikh" <ali_raza_shaikh@xxxxxxxxx>
- Date: Mon, 9 Jan 2006 03:49:22 +0500
I think Exceptions are used to give a General Error, instead of giving a
Specified Error (depends upon the Type of Exception u r using). Go down the
hieracrhy to the Format Exception Type, that can give you some useful
information
--
ALI RAZA SHAIKH
MCAD.net
alirazashaikh.blogspot.com
www.programmersparadise.cjb.net
"vooose" <nospam@xxxxxxxxxxxxx> wrote in message
news:upQtxKKFGHA.1288@xxxxxxxxxxxxxxxxxxxxxxx
> Consider executing a stored procedure which has a single INT arg:
>
> SqlCommand command = new SqlCommand("Some_Stored_Procedure", conn);
> command.CommandType =
> CommandType.StoredProcedure; command.Parameters.Add("@UserID",
> SqlDbType.Int); command.Parameters["@UserID"].Value = "150a";
> command.ExecuteReader();
>
> You receive the message "System.FormatException: Input string was not in
> a correct format"
>
> I would have expected something *slightly* more useful eg "For Parameter
> '@UserID' the format '150a' is invalid".
>
> Is this information hidden somewhere in the Exception object - or do I
> have to print out each Parameter/Value of the SQLCommand and figure it
> out myself?
>
> Regards
>
>
>
> --
> Wal
> http://www.vooose.com
>
> *** Sent via Developersdex http://www.developersdex.com ***
.
- Follow-Ups:
- Re: FormatException & Data.SqlClient.SqlCommand
- From: vooose
- Re: FormatException & Data.SqlClient.SqlCommand
- References:
- FormatException & Data.SqlClient.SqlCommand
- From: vooose
- FormatException & Data.SqlClient.SqlCommand
- Prev by Date: FormatException & Data.SqlClient.SqlCommand
- Next by Date: Re: FormatException & Data.SqlClient.SqlCommand
- Previous by thread: FormatException & Data.SqlClient.SqlCommand
- Next by thread: Re: FormatException & Data.SqlClient.SqlCommand
- Index(es):
Relevant Pages
|