Type Mismatch Error(numeric values)

S

Savas Ates

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
 
R

Ray Costanzo [MVP]

Have you tried casting your values to the same datatype?

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

Ray at work
 
M

Manohar Kamath

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top