473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 2176
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: noname | last post by:
How do I display a "0" instead of it returning "#ERROR" in a query where I have division. Also have negative numbers returned on some values, but want "0" displayed on them also.
2
by: foldface | last post by:
Hi Pardon the vague-ness, I mean the ?name=value stuff in the URL. Can you set this within javascript on a page such that when an asp.net button is clicked then these values are passed as params?...
4
by: clayne | last post by:
I realize this may work for the majority of platforms. But I am concerned about the aspects of sign extension and portability. Is this portable: { unsigned long bw; if ((signed long)(bw...
0
by: rajmgopal | last post by:
Hello Everyone I am getting the following error when i try to insert a record into Sql Server 2005 from my VB 2005 application. sqlEx = {"Error converting data type numeric to numeric."} I...
8
by: pozz | last post by:
In my software, there are some variables that represents some settings. They usually are numerical variables: unsigned char (0..255), signed char (-127..128), unsigned int (0..65535), signed int...
1
by: syang8 | last post by:
I want to declare a function F() in a class, which has two children A and B. I need A.func() return int and B.func() return double. How can I do that? The F() in parent can be empty or virtual, I...
4
by: darrel | last post by:
I'm getting this error: Arithmetic overflow error converting numeric to data type numeric. Triggered on this line of my code: objOleDbAdapter.Fill(DS, "rss") Everything works when this is...
1
by: sonata | last post by:
I am trying to compare two fields which are char data typr. BUT the comparision must be arithemetic in nature. so i tried to cast both the data base field and my parameter field to big int...
5
by: =?Utf-8?B?amlt?= | last post by:
If I assign an attribute using property name/value pairs such as where stringVal is a string C# generates the name\value pair using hex values 01 00 01 00 54 0E 09 73 74 72 69 6E 67 56 61 6C 03...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.