|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Read/Write MaxLength and AllowDBNull in System.Data.DataColumn with AccessI've an Access db and I'm using the following provider: PROVIDER=Microsoft.Jet.OLEDB.4.0 I need to make an administration tool to create and change table properties, so I need to read MaxLength and AllowDBNull properties from System.Data.DataColumn. To do so, I try to get a DataTable in the following way (DBConnection is an instance of System.Data.OleDb.OleDbConnection): IDbDataAdapter adapter = new OleDbDataAdapter(); adapter.SelectCommand = DBConnection.CreateCommand(); adapter.SelectCommand.CommandType = CommandType.Text; adapter.SelectCommand.CommandText = SqlQuery; DataSet dset = new DataSet(); adapter.Fill(dset); dset.AcceptChanges(); DataTable retTable = dset.Tables[0]; Now, retTable contains the property Columns but Columns contain only few properties (e.g. ColumnName and Caption but they don't contain the correct value of MaxLength and AllowDBNull: MaxLenght is always -1 and AllowDBNull always true). Is there a way to read this info? If so, I prefer a database-independent solution. Thank you Giorgio |
|||||||||||||||||||||||