HI,
In .Net Core ExecuteReader.GetSchemaTable() method not returning the BaseTableName and more details of the query will executed.
I'm created an console application in Core .Net 2.0. The below code has written and do some R&D. Its working in .net Framework 4x version and get all schema details asBaseTablename,BaseColumn,etc.... But in Core .Net 2.0 the BaseTableName was not returning.
Im tried in various way but still im not got the route. Can you please help me how to get the BaseTableName and all those details.
Its very important R&D to start my Project in Latest technology !
SqlConnection sqlCnn = new SqlConnection(connetionString);
sqlCnn.Open();
SqlCommand sqlCmd = new SqlCommand(sql, sqlCnn);
SqlDataReader sqlReader = sqlCmd.ExecuteReader(CommandBehavior.KeyInfo);
List<string> gotTableNames = new List<string>();
DataTable schemaTable = sqlReader.GetSchemaTable();
foreach (DataRow dr in schemaTable.Rows)
{
string data = Convert.ToString(dr["BaseTableName"]);
if (!gotTableNames.Contains(data))
{
gotTableNames.Add(data);
}
}
return string.Join(",", gotTableNames);