How to clear a recordset
Posted on 2010-08-26
In my project I have a typed dataset and a binding source to go with my bound controlls on a form. I have enteties in a separate project and a WCF-service to handle the data.
The Dataset is calld dsCustomer.
When I load the form I do this:
And the OK-button have this:
CustomerID = proxy.SaveNewCustomer(DSCustomer)
The customer is saved and everything is fine. Next time I open the form the old record is still in the dataset and I can't remove it. with dsCustomer.Clear and CustomerBindingSource.Clear throws an exception.
I guess I'm doing something wrong here. I'd be greatful for some help. (I run .NET Framework 4.0)