cannot save to datasource when bindingsource is sorted.
-
Thursday, March 29, 2012 1:34 PM
BH
Hi,
I'm using the below code, to save a single row to a datasource. This works fine, but only when the clientsBindingSource is not sorted. However, when I sort clientsBindingSource (Ascending or Descending), the below code does not save the row. Any idea as to why this is happening and how to fix it?clientsTableAdapter.Update(new[] { (clientsBindingSource.Current as DataRowView).Row });
Thanks so much.
AronThanks Aron www.EvidenceForTorah.comxa.com
- Moved by Leo Liu - MSFT Monday, April 02, 2012 9:54 AM Moved for better support. (From:Visual C# Language)
All Replies
-
Monday, April 02, 2012 9:55 AMHi aniyahudi,
I am moving your thread into the ADO.NET Managed Providers Forum for dedicated support.
Have a nice day,Leo Liu [MSFT]
MSDN Community Support | Feedback to us
-
Tuesday, April 03, 2012 2:25 AMModerator
Hi aniyahudi,
Welcome to MSDN Forum.
Could you please post more code to let me test? How do you sort the datasource?
Best Regards
Allen Li [MSFT]
MSDN Community Support | Feedback to us
-
Wednesday, April 04, 2012 1:47 PM
BH
Hi Allen, thanks so much for your reply. Here is the full code of that function:voidSaveEverything()
{
if(ClientsPanel.Visible == true)
{
this.Validate();
this.clientsBindingSource.EndEdit();
clientsTableAdapter.Update(
new[] { (clientsBindingSource.Current asDataRowView).Row });
//refresh everything is required, because without it when clicking on the Trips button,
//an exception happens that is related to the ClientsDataGridView1.
RefreshEverything();
}
elseif(TripPanel.Visible == true) // || DispatchGroupBox.Visible == true || ReportsPanel.Visible == true)
{
this.Validate();
this.trips1BindingSource.EndEdit();
tripsTableAdapter.Update(
new[] { (trips1BindingSource.Current asDataRowView).Row });
//RefreshEverything();
}
elseif(DispatchGroupBox.Visible == true)
{
this.Validate();
this.trips1BindingSource.EndEdit();
tripsTableAdapter.Update(
new[] { (trips1BindingSource.Current asDataRowView).Row });
}
elseif(ReportsPanel.Visible == true)
{
this.Validate();
this.trips1BindingSource.EndEdit();
tripsTableAdapter.Update(
new[] { (trips1BindingSource.Current asDataRowView).Row });
}
}
Thanks Aron www.EvidenceForTorah.comxa.com
-
Thursday, April 05, 2012 5:44 AMYour code is related to Windows Form, it seems not caused by you update command, it caused by your datasource. Post the question here: http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/threads
Fighting like Allen Iverson. Neve give up!
-
Friday, April 06, 2012 2:48 AMModerator
Hi aniyahudi,
Please try to update the whole datasource, don't only update the new row. If you sort the records, I'm not sure whether the state of records in your datasource are changed or not.
Best Regards
Allen Li [MSFT]
MSDN Community Support | Feedback to us
-
Friday, April 06, 2012 1:48 PM
BH
I see. But its not possible to update a single row, and have the bindingsource sorted?Thanks
Aron
Thanks Aron www.EvidenceForTorah.comxa.com
-
Sunday, April 08, 2012 8:19 AMModerator
Hi aniyahudi,
I'm afraid I'm not familiar with Winform Data Binding Controls, based on this issue, you have used datasource and data binding controls, I suggest you to post the question in Windows Forms Data Controls and Databinding Forum. There are more related specialists there, I think you can get help more effectively there. Sorry for little help.
Best Regards
Allen Li [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by Allen Li - AI3Microsoft Contingent Staff, Moderator Thursday, April 12, 2012 3:05 AM

