I'm a newbie.
I'm writing my first VB.net program. Our company gets a weekly csv file from the head office that contains a list of all employees and their contact information.
Im trying to write an application that can be used by our branch office that will automatically import the csv file into SQL express 2005.
Using this site and others I've figured out how to import the csv file (Employees.csv) into a dataset and how to use sqlBulkCopy to write the data to the employee table in the sql 2005 database. But this leaves me with 2 problems that I'm totally stuck on.
1. If an employee record already exists in the sql database then the sqlBulkcopy stops inserting and causes an error, the employee ID is the promary key in the sql db.
2. I also need to update any existing employee record in the sql db to the data that is in the csv file.
So... I'm trying to come up with a method to fix both of these problems. If anyone has a solution please provide some sample code for it as I'm very new on everthing.
TIA
I'm writing my first VB.net program. Our company gets a weekly csv file from the head office that contains a list of all employees and their contact information.
Im trying to write an application that can be used by our branch office that will automatically import the csv file into SQL express 2005.
Using this site and others I've figured out how to import the csv file (Employees.csv) into a dataset and how to use sqlBulkCopy to write the data to the employee table in the sql 2005 database. But this leaves me with 2 problems that I'm totally stuck on.
1. If an employee record already exists in the sql database then the sqlBulkcopy stops inserting and causes an error, the employee ID is the promary key in the sql db.
2. I also need to update any existing employee record in the sql db to the data that is in the csv file.
So... I'm trying to come up with a method to fix both of these problems. If anyone has a solution please provide some sample code for it as I'm very new on everthing.
TIA
Comment