|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
determine sql decimal precision in .netI would like to be able to read the scale & precision of a decimal type contained in a sql server table from vb.net. I would like to set some properties (like width,format) of a gridview's field based upon the width (scale,precision) of the database column. Previously, in VB6 with ADO i was able to do that. In .Net i can read the dataType, but that returns me a .net decimal and apparently i cannot read a scale/precision from that. Any solutions or advise would be greatly appreciated. As a side question: we've tried to use our own types in sql server 2000. Apparently these are just aliasses for the underlying type (e.g.: someAmount = decimal(6,2)). We've tried reading these types in .Net, but also here we got a .Net decimal. If we could read our types (the names) then we could style the gridview's field accordingly. Sam. You can use the GetSql<type> methods in the SqlDataReader.
e.g. rdr.GetSqlDecimal(rdr.GetOrdinal("field")); SqlDecimal struct has the fields you want. Regards, Tasos
Other interesting topics
A serious bug??
Building other sln (to build references) User control accessing outside control Textbox in User Control error -does not exist in current context Postback,Master page,User control problem SqlDataSource Datasource doesn't generate data Reading files in a pages directory GridView: Calculated Field Password Validation |
|||||||||||||||||||||||