Saturday, March 31, 2012

setting maxlength

Hi all,
I would like to set MaxLength property of asp.net controls on my page
based on their corresponding field length in Sql Server table. I know I can
get the TableSchema along with the record if I read the data into a DataSet.
But I don't want to store data in a DataSet because I am going to work on
only one record. So I don't want the overhead that comes with using a
DataSet. I will probably use a custom entity object and fill it using a
DataReader. I know how to do that. But now the question is what is the best
possible way to set MaxLength property of the controls on my page. I do not
want to hardcode the values in my page. Can anyone please throw some light
or provide sample code?
Thanks in advance.Your DataReader can also supply you with a schema table, using its
GetSchemaTable method. Each row in the table describes one column in the
data reader.
Tom Dacon
Dacon Software Consulting
"sql" <donotspam@.nospaml.com> wrote in message
news:#KonyVqSFHA.3980@.TK2MSFTNGP12.phx.gbl...
> Hi all,
> I would like to set MaxLength property of asp.net controls on my page
> based on their corresponding field length in Sql Server table. I know I
can
> get the TableSchema along with the record if I read the data into a
DataSet.
> But I don't want to store data in a DataSet because I am going to work on
> only one record. So I don't want the overhead that comes with using a
> DataSet. I will probably use a custom entity object and fill it using a
> DataReader. I know how to do that. But now the question is what is the
best
> possible way to set MaxLength property of the controls on my page. I do
not
> want to hardcode the values in my page. Can anyone please throw some light
> or provide sample code?
> Thanks in advance.
>
SQL,
Although this is winform is my sample in this message using what Tom
describes.
http://groups-beta.google.com/group...78c5467f8?hl=en
I hope this helps,
Cor

0 comments:

Post a Comment