Re: Loading a char value from an SQL parameter - Crashing!



Ignacio:

Even though the parameter is defined as being SqlDbType.Char it was showing
as a string at the breakpoint.

The Convert.ToChar solved the problem for me!

Thank you very much for your help!

Fred


"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%23frhsr9WFHA.3864@xxxxxxxxxxxxxxxxxxxxxxx
> 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
> >
> >
>
>


.



Relevant Pages

  • Re: Loading a char value from an SQL parameter - Crashing!
    ... why don't you set a breakpoint in the if line and see the type of ... a quickwatch will do the trick. ... > char - all other types are converting just fine. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Code problem
    ... If you put the breakpoint on the line I said to, there would be no attempt to save the file unless you pressed Run to continue it. ... This is the text being assigned to the fsavename variable... ... > Dim strappend As String ...
    (microsoft.public.excel.programming)
  • Re: Tcl/Tk debugger
    ... I inclused the proc and just iside the proc "plot_axes" where the error ... set labl [string trim $labl] ... if {$cmd eq "c"} break ... (compiling body of proc "breakpoint", ...
    (comp.lang.tcl)
  • Re: How to display a variable value?
    ... just set a breakpoint in your code and check the value when the breakpoint ... And in your script assign the value of the string to this hidden variable. ... Ken Dopierala Jr. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Window.open. Works in ie6. Does not work in firefox
    ... replaceneeds a regular expression, not a string. ... You should set a breakpoint: ... That is what debugging is about. ...
    (comp.lang.javascript)