Solved

ASP datatype for SQL server Numeric [Command object]

Posted on 2002-06-28
5
538 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
  • 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 6

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 6

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now