Not sure if this helps, but I get the schema of a table as follows. One of
the coumns returned is the "provider" data type, rather than the .Net data
type.
// To get the schema, we need to execute a select command.
cmd.Connection = dBase;
cmd.CommandText = "SELECT * FROM [" + strTableName + "];";
try
{
// Create the datareader, retrieving only the schema information
dataReader = cmd.ExecuteReader(CommandBehavior.KeyInfo);
// Copy the stuff we retrieved in to a data table
schemaTable = dataReader.GetSchemaTable();
// And give the data table a name that we can work with.
schemaTable.TableName = "ColumnNames";
// We don't need the data reader any more - we have what we want
dataReader.Close();
dsTemp.Tables.Add(schemaTable);
...
foreach(DataRow drColumn in dsTemp.Tables["ColumnNames"].Rows)
{
... do stuff
// There is a column with the "provider" data type in it...
columnDef.DataType =
((OleDbType)drColumn["ProviderType"]).ToString();
...
}
HTH
Steve.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2******************@TK2MSFTNGP03.phx.gbl...
Hi,
"Ian Semmel" <is***********@NOKUNKrocketcomp.com.au> wrote in message
news:Om**************@TK2MSFTNGP05.phx.gbl... If you want to do what I think you want to do, you can execute the
GetSchema call on the connection and then go through the 'Columns'
collection
Not sure if this will return the correct type name in the DB. Most
probably you will get the .NET equivalent.
But I'm not sure about this.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation