Solved

ASP datatype for SQL server Numeric [Command object]

Posted on 2002-06-28
5
544 Views
Last Modified: 2008-03-10
I have a numeric field in sql server of size 10 [it says size 9 and precision - i am confused about this also]
In my asp code when i use adNumeric as below in command object i get an error, when i use adInteger instead it works withought any problem. I fear adInteger will have a limitation of 32767 numbers. I want it to take up to 10 digits of numbers.

cmdUsers.Parameters.Append cmdUsers.CreateParameter ("USERID",   adNumeric  ,adParamInput,10)
'cmdUsers is command object


Any help greatly appreciated.
0
Comment
Question by:sanjaykattimani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 200 total points
ID: 7116208
If you specify a numeric data type adNumeric in the Type argument, then you must also set the NumericScale and Precision properties.

cmdUsers.Parameters.Item(0).NumericScale = ???
cmdUsers.Parameters.Item(0).Precision = ???


hongjun
0
 
LVL 9

Expert Comment

by:Nitin Sontakke
ID: 7116884
Given below is the text from books-online help of SQL 2K. If you are using adNumeric just for having more int space, you might get idea of max limits of each data type. Please don't confuse between Integer of vb and sql server. The Int in vb is sql server's smallint and long in vb is sql server's int.

---

int, bigint, smallint, and tinyint
Exact number data types that use integer data.

bigint

Integer (whole number) data from -2^63 (-9223372036854775808) through 2^63-1 (9223372036854775807). Storage size is 8 bytes.

int

Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int is integer.

smallint

Integer data from -2^15 (-32,768) through 2^15 - 1 (32,767). Storage size is 2 bytes.

tinyint

Integer data from 0 through 255. Storage size is 1 byte.

0
 
LVL 9

Expert Comment

by:Nitin Sontakke
ID: 7116894
One more thing. While using all numeric data-types i have always skiped the size parameter of parameter object and never seem to have any problems. Size problem is significant only in case of char type of data. But i could be wrong. However, it is worth trying by omitting the size parameter.
0
 
LVL 3

Author Comment

by:sanjaykattimani
ID: 7117991
Thanks guys,
Dear Nitin,
 i am using SQL server 7.0 and not sure whether the same[data type size] is applicable to it.

I tried setting numeric scale and precision properties as adviced by hongjun it works.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7118007
>>as adviced by hongjun it works.
So your problem solved?

hongjun
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question