Hi, This is my piece of code.Im getting all the tables names and col names present in the database .Now i need to know the type of column .like its int or varchar or something else .Can any one help me in this ?? and btw this is C# .
OleDbConnection con = new OleDbConnection(connectionString);
DataTable schemaCols;
DataTable schemaTbl;
List<string> tablesnames = new List<string>();
string returnString="";
try
{
con.Open();
object[] objArrRestrict;
objArrRestrict = new object[] { null, null, null, "TABLE" };
schemaTbl = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, objArrRestrict);
foreach (DataRow row in schemaTbl.Rows)
{
tablesnames.Add(row["TABLE_NAME"].ToString());
}
List<string> columnnames = new List<string>();
foreach (string str in tablesnames)
{
string selTbl = str;
//con.Open();
object[] objArrRestrictNew;
objArrRestrictNew = new object[] { null, null, selTbl, null };
//
schemaCols = con.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, objArrRestrictNew);
foreach (DataRow row in schemaCols.Rows)
{
columnnames.Add(row["COLUMN_NAME"].ToString());
}
}
}