MTecho
asked on
MaxLength for varchar column
To store a string in a varchar field the maximum length of string is needed to avoid a data-truncation error.
The following code only returns -1 if the column is varchar or ntext:
dr.Table.Columns(Ind).MaxL ength
where Ind is the index of the required column.
dr.Table.Columns(Ind).Data Type.ToStr ing only returns "System.String", if the column is varchar or ntext.
What is the equivalent of the VB6 Fd.DefinedSize (where Fd is ADODB.Field)?
The following code only returns -1 if the column is varchar or ntext:
dr.Table.Columns(Ind).MaxL
where Ind is the index of the required column.
dr.Table.Columns(Ind).Data
What is the equivalent of the VB6 Fd.DefinedSize (where Fd is ADODB.Field)?
ASKER
Thank you for that, Graye.
However, dr.Table.Columns(Ind).Data Type.ToStr ing still returns "System.String", if the column is varchar or ntext.
Is it possible to get the Data Type from the table in the SQL database?
However, dr.Table.Columns(Ind).Data
Is it possible to get the Data Type from the table in the SQL database?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To get the fully populated schema (which includes the column widths) just add the following:
DataAdapter.MissingSchemaA