467,923 Members | 1,431 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,923 developers. It's quick & easy.

setting maxlength

sql
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.
Jul 21 '05 #1
  • viewed: 1167
Share:
2 Replies
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" <do*******@nospaml.com> wrote in message
news:#K**************@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.

Jul 21 '05 #2
SQL,

Although this is winform is my sample in this message using what Tom
describes.

http://groups-beta.google.com/group/...8c5467f8?hl=en

I hope this helps,

Cor
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Buck Turgidson | last post: by
7 posts views Thread by ray | last post: by
2 posts views Thread by sql | last post: by
2 posts views Thread by Craig G | last post: by
9 posts views Thread by The Confessor | last post: by
1 post views Thread by Mel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.