Re: Loading a char value from an SQL parameter - Crashing!
- From: "Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT dot.state.fl.us>
- Date: Wed, 18 May 2005 14:53:46 -0400
Hi,
why don't you set a breakpoint in the if line and see the type of
p_locatestatus.Value, a quickwatch will do the trick.
Also what about using Convert.ToChar instead of the cast?
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Fred Nelson" <fred@xxxxxxxxxxxxxx> wrote in message
news:eHjCti9WFHA.2980@xxxxxxxxxxxxxxxxxxxxxxx
> Hi:
>
> Newby Question:
>
> I have the following code in a class library that performs a query on an
> SQL
> database and is returning a class that contains "locatestatus":
>
> if (p_locatestatus.Value != System.DBNull.Value)
> { rtrec.locatestatus = (char)p_locatestatus.Value; };
>
> rtrec.locatestatus is a char.
>
> This compiles just fine however it causes an error and is trapped by my
> try/catch everytime. There must be something that I need to do to convert
> a
> char - all other types are converting just fine.
>
> Any info on the steps I'm missing would be greatly appreciated!
>
> Thanks,
>
> Fred
>
>
.
- Follow-Ups:
- Re: Loading a char value from an SQL parameter - Crashing!
- From: Fred Nelson
- Re: Loading a char value from an SQL parameter - Crashing!
- References:
- Loading a char value from an SQL parameter - Crashing!
- From: Fred Nelson
- Loading a char value from an SQL parameter - Crashing!
- Prev by Date: Cursor.Current reverting to default
- Next by Date: Re: C# very optimisation
- Previous by thread: Re: Loading a char value from an SQL parameter - Crashing!
- Next by thread: Re: Loading a char value from an SQL parameter - Crashing!
- Index(es):
Relevant Pages
|