Hi all,
I have two datasets, the first dataset contains the data for a company selected directly from the database (The first column is an auto-incrementing field). The second dataset contains data that was extracted from a .CSV file. What I need to do is to take the data that was uploaded and insert it into the database dataset, and then update the database with the combined dataset.
In order to enable updating the database I am using the command builder. The problems that I am having is combining both datasets together. My plan was to originally take each record from the .CSV file and firstly check to see if the customer mobile number was in the dataset from the database. If it was then the operation was an update, else it was an insert.
Once all the insert and update operations have been completed, I would then Update the database.
Mike55.
I have two datasets, the first dataset contains the data for a company selected directly from the database (The first column is an auto-incrementing field). The second dataset contains data that was extracted from a .CSV file. What I need to do is to take the data that was uploaded and insert it into the database dataset, and then update the database with the combined dataset.
In order to enable updating the database I am using the command builder. The problems that I am having is combining both datasets together. My plan was to originally take each record from the .CSV file and firstly check to see if the customer mobile number was in the dataset from the database. If it was then the operation was an update, else it was an insert.
Code:
dim drwSelect as DataRow()
drwSelect = dstDatabase.Tables(0).Select("MobileNumb=" & selectResult & "")
if drwSelect.Length = 0 Then
Insert operation.
dstDatabase.Tables(0).LoadDataRow(drwSelect, True)
Else
Update operation.
End If
Once all the insert and update operations have been completed, I would then Update the database.
Mike55.