azrakdragon
asked on
Size of a datacolumn
Is there a way to retrieve the size of a datacolumn? I am looping thru the columns of a table in a dataset in order to retrieve the column name and size. Column name is no problem but I cannot get the size. Anyone?
grdtable.TableStyles(0).Gr idColumnSt yles(colnu mber).Widt h = 'Your width'
Hi azrakdragon, Why would you want to know that, all columns except the string have a fixed size.
and the string type doesn't support a fixed size.
and the string type doesn't support a fixed size.
ASKER
Looping thru a dataset, not a datagrid.
ASKER
I need to determine the length of ech column that is a string type as a flat file is being created with fixed lengths. It needs to be dynamic without a user having to maintain the lengths of each column but having them set using the size of the field in the table.
Well to only way to do this is loop through your datatable and check the lenght of each string in the column
ASKER
It would also come in handy for other things like setting the max length of a text box based on the field it is retrieving its value from etc...
ASKER
Hi RonaldBiemans, If I loop and check the length of each string will the length returned not necessarily be the length defined for the field in the database. i.e. Varchar field of size 50 holds the value "test". The length returned would be 4 instead of 50.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi RB, many thanks