Hi,
I have a table of (lets just say) 'customers' that I create a subset using the following statement:
The newly created 'SingleCustTable' I then pass to another form for the user to configure some options. The problem I have is when this form returns the 'SingleCustTable'.
Essentially what I'm trying to do is keep track of customer records in the master 'CustomersTable' for each customerID.
The code I use when the configuration changes are made is:
The issue I'm having is that everytime the form is opened and the user clicks OK the same rows are added to the 'CustomersTable' so I get duplicates. I hoped the merge method might be able to handle this but it looks like I might have to delete the rows that are captured in the 'SingleCustTable' when the user clicks OK.
Does anybody know if there is a simple way to handle a subset of table which can then easily be merged back into the table the subset was created from?
As an aside I've tried to delete the rows and that failed!
I used:
The above raises an exception though - indicates that the row doesn't exist in the CustomersTable.
Any help would be appreciated.
Thanks,
N
I have a table of (lets just say) 'customers' that I create a subset using the following statement:
Code:
CustomersTable.Select("CustomerID=2").CopyToDataTable(SingleCustTable, LoadOption.PreserveChanges)Essentially what I'm trying to do is keep track of customer records in the master 'CustomersTable' for each customerID.
The code I use when the configuration changes are made is:
Code:
Dim RetVal as Byte = f.ShowDialog ' f is the form that uses the individually created 'SingleCustTable'
If RetVal = vbOK Then
' If the customer has changed the data in their 'SingleCustTable' (i.e. the local copy I pass to the form)
CustomersTable.Merge(f.MyTable) ' MyTable is a property in the form that gives me access to the instance of the SingleCustTable I passed to itEnd IfDoes anybody know if there is a simple way to handle a subset of table which can then easily be merged back into the table the subset was created from?
As an aside I've tried to delete the rows and that failed!
I used:
Code:
For Each CustRow in SingleCustTable
CustomersTable.RemoveRow(CustRow)Next CustRowAny help would be appreciated.
Thanks,
N