I need to get the real column name from DataTable which I filled it by FillSchema()
method,
this is the query I used (SELECT ID AS [SNO],CATEG_NAME AS [Category] FROM Categories)
var dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("SELECT ID AS [SNO],CATEG_NAME AS [Category] FROM Categories",conn);
da.FillSchema(dt, SchemaType.Source);
dt.FillBySql(sql);
When I check dt.columns
I find that there are 2 columns with the same alias name which mentioned in query. What can I do to get the real column names(id, categ_name)
?