setting maxlength

S

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.
 
T

Tom Dacon

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top