L
LT
Hi everybody,
I'm filling a datagridview taking data from a db table in the following
way:
-------------------------------------------------------------------
DataClasses1DataContext Ddc = new DataClasses1DataContext();
listaDataGridView.DataSource = Ddc.GetTable<Table>();
-------------------------------------------------------------------
Then I do insertion operations:
-------------------------------------------------------------------
Table table = new Table
{
Code = code,
Description = description
};
Ddc.Table.InsertOnSubmit(table);
Ddc.SubmitChanges();
-------------------------------------------------------------------
and updations:
-------------------------------------------------------------------
Table tab = Ddc.Table.Where(c => c.ID == id).First();
tab.Codice = code;
tab.Descrizione = description;
Ddc.SubmitChanges();
-------------------------------------------------------------------
This is the datagridview refresh :
-------------------------------------------------------------------
Ddc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues,
Ddc.Table);
-------------------------------------------------------------------
The problem is that inserted rows are not viewed until the next opening
of the form.
This is partially solved if I use:
-------------------------------------------------------------------
DataClasses1DataContext Ddc = new DataClasses1DataContext();
listaDataGridView.DataSource = Ddc.Table.ToArray();
-------------------------------------------------------------------
But in this way the datagridview don't let me to order columns anymore.
Can someone help me?
Thanks and Regards,
Luigi
I'm filling a datagridview taking data from a db table in the following
way:
-------------------------------------------------------------------
DataClasses1DataContext Ddc = new DataClasses1DataContext();
listaDataGridView.DataSource = Ddc.GetTable<Table>();
-------------------------------------------------------------------
Then I do insertion operations:
-------------------------------------------------------------------
Table table = new Table
{
Code = code,
Description = description
};
Ddc.Table.InsertOnSubmit(table);
Ddc.SubmitChanges();
-------------------------------------------------------------------
and updations:
-------------------------------------------------------------------
Table tab = Ddc.Table.Where(c => c.ID == id).First();
tab.Codice = code;
tab.Descrizione = description;
Ddc.SubmitChanges();
-------------------------------------------------------------------
This is the datagridview refresh :
-------------------------------------------------------------------
Ddc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues,
Ddc.Table);
-------------------------------------------------------------------
The problem is that inserted rows are not viewed until the next opening
of the form.
This is partially solved if I use:
-------------------------------------------------------------------
DataClasses1DataContext Ddc = new DataClasses1DataContext();
listaDataGridView.DataSource = Ddc.Table.ToArray();
-------------------------------------------------------------------
But in this way the datagridview don't let me to order columns anymore.
Can someone help me?
Thanks and Regards,
Luigi