T
Trainee
hi
i am using OleDbSchemaGuid.Columns method to return the column
names,datatype and other details of a table...but this method returns
datatype as a number and that number corresponds to a data type but the
problem is lots of data types have same number
for eg. text,char,varchar have same number 129
nchar,ntext,nvarchar have number 130
so am not able to differentiate between the data types based on these
numbers...my code snippet is as follows
OleDbConnection connection = new OleDbConnection(connectionstring);
connection.open;
DataTable schemaTable =
connection.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new
object[]{null,null,table_name,null});
foreach(DataRow schemaRow in schemaTable.Rows)
{
schemaRow["column_name"].ToString(); // returns the column name
schemaRow["data_type"].ToString(); // returns the data type as a number....
}
connection.close;
plz help me out to differentiate between the data types..
i am using OleDbSchemaGuid.Columns method to return the column
names,datatype and other details of a table...but this method returns
datatype as a number and that number corresponds to a data type but the
problem is lots of data types have same number
for eg. text,char,varchar have same number 129
nchar,ntext,nvarchar have number 130
so am not able to differentiate between the data types based on these
numbers...my code snippet is as follows
OleDbConnection connection = new OleDbConnection(connectionstring);
connection.open;
DataTable schemaTable =
connection.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new
object[]{null,null,table_name,null});
foreach(DataRow schemaRow in schemaTable.Rows)
{
schemaRow["column_name"].ToString(); // returns the column name
schemaRow["data_type"].ToString(); // returns the data type as a number....
}
connection.close;
plz help me out to differentiate between the data types..