I am doing a simple application with a MSaccess MDB database.
I have two Table and one DataGridView.
Access File had been added with the wizard of visual studio and the DataGridView binded to Table Two the source using the form UI.
Table One is full with 929 rows and Table Two is empty.
I'd like to select rows from Table One and Import on Table Two.
- How can I select a row checking a value inside a field, if the value is calculated inside the program?
- Why the DataGridView is not updated with the selection of rows?
I tryed also with tableadapter.update or similar, but is not functioning.
Thanks for Help.
Stefano
Loading
StefanoPosted Mar 24, 2009, 4:40 AM
I saw in debug that the dataTable Selezione is filled but not displayed in the DataGridView.
I canceled DataSource completely and re-add to the project Binded DataGridView to the Selezione DataTable and now the data are displayed
Thanks
My code is :
private void Sceltainf_Click(object sender, EventArgs e)
{
valvoleDataSet.Tables["Selezione"].Clear();//Cancello la Tabella Selezione
int k=0;
foreach (DataRow row in valvoleDataSet.Valvole.Rows)
{
valvoleDataSet.Selezione.ImportRow(valvoleDataSet.Valvole.Rows[k]);
selezioneTableAdapter.Update(valvoleDataSet.Selezione);
k++;
}
dbGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
}
ArshadPosted Mar 24, 2009, 1:28 AM
you can do some thing like that, just get the data in dataset, and write on function for calculating the value and display that value in the gridview with the otherfields, and put one checkbox in gridview at veryfirst position, so that user can select the row after viewing that calculated value. and use the gridview events to insert the value of that row in table2. i think u need to have one more Column[bit(Datatype)] in table1 also like after inserting in the table 2 u dont want to display in gridview for that you need to update that column to 0.
and check it very first that it must be 1.
2. you need to Call the function again where you are doing databinding, so that that gridview will get updated.