Hey,
Is there a elegant way, to bind predefined dataGridView columns with results from sql statement?
Example:
dataGridView1.Columns.Add("EID", "ID");
dataGridView1.Columns.Add("FName", "FirstName");
some sql like SELECT t.FirstName as FName, t.EmpID as EID FROM table t
...
and then I call dataGridView1.DataSource = someDataSet.Tables[0].DefaultView
;
The last call add columns to my datagrid but I just want to bind it by column name not to add new columns.
The example will give a result like this:
Table coulumns: ID, FirstName, FName, EID (ID and FirstName holds empty cells)
How to get this:
Table coulumns: ID, FirstName or FirstName, ID
Best Regards!