Hi, I need help on how to update to the database if there are new records added in CSV file.
If only 3 new records added in the CSV file, only insert those 3 new records, not all records.
- if (LWT > 0)
- {
- Console.WriteLine("There are no changes in lastWriteTime CSV file");
- }
- else
- {
- Console.WriteLine("There are changes lastWriteTime in CSV file");
- var lf2 = "insert into
- listfile(filename,lastwritetime)values(@filename,@lastwritetime)";
- var cmd3 = new NpgsqlCommand(lf2, conn);
- cmd3.Parameters.AddWithValue("filename", Convert.ToString(file));
- string filename = cmd3.Parameters["@filename"].Value.ToString();
- Console.WriteLine("Record inserted successfully. filename = " + file);
- }