Note that there are some explanatory texts on larger screens.

plurals
  1. POcheckbox & datagridview not reading new column, write works fine (c#)
    primarykey
    data
    text
    <p>I have datagridview which is bound to a data source (a dataset based on a SQL view). It is made up of mostly textboxes with a few checkboxes. On the form which contains the DGV there are controls for editing each of the column. On Form_Load the view gets populated with the contents of the SQL view. This is done using the Fill command of the table adapter, and works perfectly. </p> <p>Now I add a new column to the DGV by modifying the data source to include a new bit value. I add the new column using the Tasks editor for the datagrid view. I add a corresponding checkbox to the form to set the value of this column which is bound to the binding source used by the DGV. If I check this new checkbox and hit "save", the database is updated with the new value, but this change is not reflected in the DGV or the bound checkbox control. The sequence is as follows:</p> <pre><code>//execute the update statement: command.ExecuteNonQuery(); //refill the table: vwTILEAdminTableAdapter.Fill(tILEDataSet.vwTILEAdmin); //reset the binding source - maybe the problem is here? vwTILEAdminBindingSource.DataSource = typeof(TILEDataSet.vwTILEAdminDataTable); vwTILEAdminBindingSource.DataSource = this.tILEDataSet.vwTILEAdmin; dataGridView1.DataSource = null; dataGridView1.DataSource = this.vwTILEAdminBindingSource; vwTILEAdminBindingSource.ResetBindings(false); // false for data change, true for schema change vwTILEAdminBindingSource.EndEdit(); </code></pre> <p>This has always seemed to work in the past when I have modified the DGV in any way. It seems the binding is only working in one direction (write), as I can see the changes to the database in SQL Management Studio after each save, yet the new checkbox always shows a value of zero. I even tried deleting the DGV and re-adding it along with all of the events.</p> <p>I just found the EndEdit command this morning but it makes no difference. I also tried setting the argument of ResetBindings to true and that also made no difference.</p> <p>I thought this would be a 10 minute change and I'm out of ideas. Thanks in advance for any insight.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload