When filling a DataSet from a DataAdapter, column lengths are, by default,
not included in the DataSet's schema.In order to get the maxLength of a string
column from the database, set the DataAdapter's MissingSchemaAction property:
SqlDataAdapter da = new SqlDataAdapter("select * from bob", this.MyConnectionString);
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataSet ds = new DataSet();
da.Fill(ds, "MyTable");
string xml = ds.GetXmlSchema();
from a solution provided by David Stevenson in Message #1085638
|