hello,
i have this code
using (SqlConnection conn = new SqlConnection(ConnectionString))
{
conn.Open();
DataTable Databases = conn.GetSchema("Databases");
DataTable Tables = conn.GetSchema("Tables");
DataTable Columns = conn.GetSchema("Columns");
conn.close();
}
i need to return datattype by reading string value in column "DATA_TYPE"
foreach (DataRow row in Columns.Rows)
if (row["TABLE_NAME"].ToString() == tableName)
{
if (fName == row["COLUMN_NAME"].ToString())
{
//return Datatype
var x = row["DATA_TYPE"];
}
}
////if(row["DATA_TYPE"] == "int") how i can set var x by DataType (Int) or how to get datatype by name that is found in row["DATA_TYPE"]??!!