enforcing max lenght on dataset column

  • Thread starter Thread starter Uzi Baruch
  • Start date Start date
U

Uzi Baruch

Hi!

is there a way to enforce the max lenght of the coulmn as it is defined in
the database.

from what i checked the default is -1 which says no maximum lenght, and i
want to be able to enforce the lenght from the database

thanks,
Uzi
 
hi,

Uzi Baruch said:
Hi!

is there a way to enforce the max lenght of the coulmn as it is defined in
the database.

from what i checked the default is -1 which says no maximum lenght, and i
want to be able to enforce the lenght from the database

As far as I know the dataset should enforce it if you set the property
correctly.
Set the maxLength yourself or look at DataAdapter.FillSchema for getting
schema information.

If your DataSet hat EnforceConstraints = true it should throw an
ArgumentException if you try to assign a value too large.

hth
Uwe
 
Hi Uwe,

DataColumn has MaxLength property which is enforced, while strong typed
dataset does not provide it at design time AFAIK.
I wonder why.
 
Hi Miha,

Miha Markic said:
Hi Uwe,

DataColumn has MaxLength property which is enforced, while strong typed
dataset does not provide it at design time AFAIK.
I wonder why.

Ah! Ok. Good to know. I never used strong typed datasets so I can't say much
about them.
I thought we were talking about the DataSet class itself.

Thanks
Uwe
 
Ah! Ok. Good to know. I never used strong typed datasets so I can't say much
about them.
I thought we were talking about the DataSet class itself.

I don't know - I was just presuming strong typed datasets (as I use them
almost for everything) :)
 
Back
Top