Hello all. I am sure this has been asked before and I hope its an easy answer. I have some code that inserts information from a csv into sqlite. The csv has 9 colums but the table has 10 becuase I added a datetime column that needs to be added. I found some snips that seem to work, but I am not sure how to insert the date with it. I am trying not to have to break the csv into an array or something over complicated. below is the code and this is the web address of the instruction I found .
http://www.techbrothersit.com/2016/04/c-how-to-import-or-load-text-file-to.html
- while ((line = SourceFile.ReadLine()) != null)
- {
-
- if (counter > 0)
- {
-
- string query = "Insert into " + TableName +
- " Values ('" + line.Replace(filedelimiter, "','") + "')";
-
-
- SQLiteCommand myCommand = new SQLiteCommand(query, sqlConn);
- myCommand.ExecuteNonQuery();
- }
- counter++;
- }