How do a get a sql serverSscale value from a numeric datatype

  • Thread starter Thread starter Greg Robinson
  • Start date Start date
G

Greg Robinson

Windows Forms Application
Sql Server backend
Controls are bound to a DataSet

I want to restrict the amount of numbers to the right of the decimal a user
can enter into a control that is bound to a sql server numeric, .net
system.decimal.

If the numeric's scale is 2 then the user can only enter 2 numbers to the
right of the decimal. If the numeric's scale is 3 then the user can only
enter 3 numbers to the right of the decimal, etc....

I want this to be dynamic, the control 'knows to do this'.

How can I get the value of the scale through ADO.NET?
 
One alternative is to go back against the database and retrieve the scale
value. For example:

Select numeric_scale
FROM Information_Schema.Columns
WHERE Table_Name='MyTableName' AND Column_Name='MyColumnName'

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Windows Forms Application
Sql Server backend
Controls are bound to a DataSet

I want to restrict the amount of numbers to the right of the decimal a user
can enter into a control that is bound to a sql server numeric, .net
system.decimal.

If the numeric's scale is 2 then the user can only enter 2 numbers to the
right of the decimal. If the numeric's scale is 3 then the user can only
enter 3 numbers to the right of the decimal, etc....

I want this to be dynamic, the control 'knows to do this'.

How can I get the value of the scale through ADO.NET?
 
David, thanks.

How can I, if at all, get ADO.NET to pull back this schema info on the
call to DataAdapter.Fill? Looks like I cannot from what I see.
 
Greg:

I did look at this approach, but as of now, I have not had any success. I
will give it some additional thought and let you know if I am successful.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.



David, thanks.

How can I, if at all, get ADO.NET to pull back this schema info on the
call to DataAdapter.Fill? Looks like I cannot from what I see.
 
Back
Top