i have 3 columns in sql server ..

all of them are numeric value

when a user enter my site i take the value of userid (numeric one) i assign
it as session("userid ")

after a query i take 2 value (both numeric again) from my table and write
this code

if towhom=session("userid") then towhom=fromwhom

it gives an error .. how can i solve it

Type Mismatch Error

Re: Type Mismatch Error(numeric values) by Ray

Ray
Fri Oct 08 10:45:01 CDT 2004

Have you tried casting your values to the same datatype?

If CInt(towhom) = CInt(Session("UserID"))...

Ray at work

"Savas Ates" <savas@indexinteractive.com> wrote in message
news:ueVWKyUrEHA.452@TK2MSFTNGP09.phx.gbl...
>i have 3 columns in sql server ..
>
> all of them are numeric value
>
> when a user enter my site i take the value of userid (numeric one) i
> assign
> it as session("userid ")
>
> after a query i take 2 value (both numeric again) from my table and write
> this code
>
> if towhom=session("userid") then towhom=fromwhom
>
> it gives an error .. how can i solve it
>
> Type Mismatch Error
>
>



Re: Type Mismatch Error(numeric values) by Manohar

Manohar
Fri Oct 08 10:51:45 CDT 2004

Ray,

Casting into String is the best option, since other cast functions give
errors if the input is not numeric (e.g. empty)

If CStr(towhom) = CStr(Session("UserID")) Then...

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:%23UXgp2UrEHA.3252@TK2MSFTNGP14.phx.gbl...
> Have you tried casting your values to the same datatype?
>
> If CInt(towhom) = CInt(Session("UserID"))...
>
> Ray at work
>
> "Savas Ates" <savas@indexinteractive.com> wrote in message
> news:ueVWKyUrEHA.452@TK2MSFTNGP09.phx.gbl...
> >i have 3 columns in sql server ..
> >
> > all of them are numeric value
> >
> > when a user enter my site i take the value of userid (numeric one) i
> > assign
> > it as session("userid ")
> >
> > after a query i take 2 value (both numeric again) from my table and
write
> > this code
> >
> > if towhom=session("userid") then towhom=fromwhom
> >
> > it gives an error .. how can i solve it
> >
> > Type Mismatch Error
> >
> >
>
>



Re: Type Mismatch Error(numeric values) by Ray

Ray
Fri Oct 08 11:12:08 CDT 2004

Good point.

Ray at work

"Manohar Kamath" <mkamath@TAKETHISOUTkamath.com> wrote in message
news:e9YZ36UrEHA.596@TK2MSFTNGP11.phx.gbl...
> Ray,
>
> Casting into String is the best option, since other cast functions give
> errors if the input is not numeric (e.g. empty)
>
> If CStr(towhom) = CStr(Session("UserID")) Then...