DataColumn Size for Numbers??

  • Thread starter Thread starter John B.
  • Start date Start date
J

John B.

Is there a way to test the size restriction of a number (int or decm)
on a dataset? I know that the DataColumn.MaxLength Property only
supports text fields. Is there anything that can be used just like
this property but applies to numbers?

Using Oracle 9i & ODP
 
How do you know if the 'value isn't good'? I have no problem
enforcing the constraint within my code as long as I know what the
constraint is. I do not want to hard code constants for field sizes. I
thought there may be a property on the dataColumn (or other object)
that would tell me the MaxLength of a number column. I do not want to
have to maintain a set of lengths in 2 places (code and DB). It makes
more sense to have one central location for the constraints.


Miha Markic said:
Hi John,

Throw an exception in RowChanging event if value isn't good.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

John B. said:
Is there a way to test the size restriction of a number (int or decm)
on a dataset? I know that the DataColumn.MaxLength Property only
supports text fields. Is there anything that can be used just like
this property but applies to numbers?

Using Oracle 9i & ODP
 
maybe something like this...

select a.data_precision
from sys.all_tab_cols a
where table_name='xxxx'
and column_name='yyyy'

John B. said:
How do you know if the 'value isn't good'? I have no problem
enforcing the constraint within my code as long as I know what the
constraint is. I do not want to hard code constants for field sizes. I
thought there may be a property on the dataColumn (or other object)
that would tell me the MaxLength of a number column. I do not want to
have to maintain a set of lengths in 2 places (code and DB). It makes
more sense to have one central location for the constraints.


"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi John,

Throw an exception in RowChanging event if value isn't good.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

John B. said:
Is there a way to test the size restriction of a number (int or decm)
on a dataset? I know that the DataColumn.MaxLength Property only
supports text fields. Is there anything that can be used just like
this property but applies to numbers?

Using Oracle 9i & ODP
 
....the where clause should also include " and owner='zzz' "

ivo said:
maybe something like this...

select a.data_precision
from sys.all_tab_cols a
where table_name='xxxx'
and column_name='yyyy'

John B. said:
How do you know if the 'value isn't good'? I have no problem
enforcing the constraint within my code as long as I know what the
constraint is. I do not want to hard code constants for field sizes. I
thought there may be a property on the dataColumn (or other object)
that would tell me the MaxLength of a number column. I do not want to
have to maintain a set of lengths in 2 places (code and DB). It makes
more sense to have one central location for the constraints.


"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi John,

Throw an exception in RowChanging event if value isn't good.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Is there a way to test the size restriction of a number (int or decm)
on a dataset? I know that the DataColumn.MaxLength Property only
supports text fields. Is there anything that can be used just like
this property but applies to numbers?

Using Oracle 9i & ODP
 
Back
Top