I have a datagridview1, which has a comboboxcolumn categoryname(which is binded to a database table Category )
listCol.DataSource = cDS.Tables["Category"];
datagridview1 also has two textbox column named description and amount which are not binded to any datasource.
Now I want to bind this datagridview1 to a new database table called transact_table, so that whatever the user selects from the combboxcolumn and whatever the user types in the textbox of the datagridview has to be written in my database table transact_table.
this is how I am trying:
Expand|Select|Wrap|Line Numbers
- SqlDataAdapter transactDataAdapter = new SqlDataAdapter("select * from Transact_table", connection);
- //DataTable pTable1 = cDS.Tables["Table"];
- DataTable pTable1 = new DataTable();
- transactDataAdapter.Fill(pTable1);
- dataGridView1.DataSource = cDS.Tables["Table"];
- transactDataAdapter.Update(pTable1);