Mike,
Is this SQL server you are working with? If so, you can use the
SqlBulkCopy class in .NET 2.0. If you are using .NET 1.1 and before (and
SQL Server still), then you can use the BULK INSERT command to quickly
insert the contents of the CSV file.
If you are not working with SQL Server, then you might want to create a
Data Transformation Services package which you can use to read the CSV file
and put it into your database.
Worse comes to worse, you can read the contents of the CSV file into a
DataSet (using the text provider for OLE DB) and then set the state of the
rows to new (using the SetAdded method on the DataRow, if you are using .NET
2.0, if using .NET 1.1, then you will have to create a new DataSet and add
the row to the new data set).
Once you do that, you can create a DataAdapter using your provider and
then update your database.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Mike P" <mi*******@gmail.comwrote in message
news:OR**************@TK2MSFTNGP03.phx.gbl...
Does anybody have a simple example of reading the contents of a CSV file
into a database table?
*** Sent via Developersdex http://www.developersdex.com ***