I have a DataGridView that I installed in a WinForms project. Columns are defined in the constructor file. When I run my SQL, the columns in the DataGridView are replaced with the column names in the query.
How to save columns defined in a DataGridView, and just add rows from a dataset from a dataset to a GridView.
Name | Address | City | State | Zip | Account Num |
DataSet ds = Account.search(strSearch);
accountGrid.DataSource = ds.Tables[0];
string sql = "SELECT distinct acctNum, name, address, city, state, zip from accounts";
return DataService.GetDataSet(sql);
acctNum | name | address |city | state | zip
Scott source
share