Solved

ASP datatype for SQL server Numeric [Command object]

Posted on 2002-06-28
5
541 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP/VB email question 4 63
How to post data to an API using ASP Classic 3 32
VB script help 23 36
Ajax on ASP 2 42
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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/…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

730 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