471,071 Members | 5,794 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Type Mismatch Error(numeric values)

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
Jul 19 '05 #1
3 2060
Have you tried casting your values to the same datatype?

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

Ray at work

"Savas Ates" <sa***@indexinteractive.com> wrote in message
news:ue*************@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

Jul 19 '05 #2
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:%2****************@TK2MSFTNGP14.phx.gbl...
Have you tried casting your values to the same datatype?

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

Ray at work

"Savas Ates" <sa***@indexinteractive.com> wrote in message
news:ue*************@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


Jul 19 '05 #3
Good point.

Ray at work

"Manohar Kamath" <mk*****@TAKETHISOUTkamath.com> wrote in message
news:e9*************@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...

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by =?Utf-8?B?amlt?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.