Home All Groups Group Topic Archive Search About
Author
30 Jan 2006 2:18 PM
Kari Lappalainen
Hi everybody!

Do someone know the easiest way to obtain the datacolumn size in code (I
mean the size that
you define creating a text field in a table)? In VB6 you could get it by
means of Recordset.Field.
DefinedSize property. I have been searchin for something similar in ADO.NET
but without luck.

Thanks beforehand

Author
30 Jan 2006 2:40 PM
Cor Ligthert [MVP]
Kari,

Would you believe this. MaxLength

http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.maxlength.aspx

I hope this helps,

Cor

Show quote
"Kari Lappalainen" <klappalai***@taya.com> schreef in bericht
news:e3nyQgaJGHA.1088@tk2msftngp13.phx.gbl...
> Hi everybody!
>
> Do someone know the easiest way to obtain the datacolumn size in code (I
> mean the size that
> you define creating a text field in a table)? In VB6 you could get it by
> means of Recordset.Field.
> DefinedSize property. I have been searchin for something similar in
> ADO.NET but without luck.
>
> Thanks beforehand
>
>
Author
30 Jan 2006 3:00 PM
MrSmersh
For SQL server you should use sp_columns.
Or sp_help.
The Ado.Net catalog information part is not very implemented/working...
This method will work for sure...

Show quote
"Kari Lappalainen" wrote:

> Hi everybody!
>
> Do someone know the easiest way to obtain the datacolumn size in code (I
> mean the size that
> you define creating a text field in a table)? In VB6 you could get it by
> means of Recordset.Field.
> DefinedSize property. I have been searchin for something similar in ADO.NET
> but without luck.
>
> Thanks beforehand
>
>
>
Author
30 Jan 2006 3:21 PM
W.G. Ryan - MVP
Kari:

Are you looking for columns in general or just Text Columns?  Also, is what
you're looking for the Schema information, i.e. the size of the column in
the db?  If so, what back end DB are you using?
Show quote
"Kari Lappalainen" <klappalai***@taya.com> wrote in message
news:e3nyQgaJGHA.1088@tk2msftngp13.phx.gbl...
> Hi everybody!
>
> Do someone know the easiest way to obtain the datacolumn size in code (I
> mean the size that
> you define creating a text field in a table)? In VB6 you could get it by
> means of Recordset.Field.
> DefinedSize property. I have been searchin for something similar in
> ADO.NET but without luck.
>
> Thanks beforehand
>
>

AddThis Social Bookmark Button