import csv file/excel into sql database asp.net

后端 未结 5 1213
傲寒
傲寒 2020-12-14 05:02

I am starting a project with asp.net visual studio 2008 / SQL 2000 (2005 in future) using c#.

The tricky part for me is that the existing DB schema changes often and

5条回答
  •  太阳男子
    2020-12-14 05:33

    You can easily create an IDataReader over an Excel or CSV file (see http://support.microsoft.com/kb/316934).

    Are you using SQL Server as your database engine? If so, you can use the SqlBulkCopy class (http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx) to efficiently take your IDataReader, map columns as appropriate, and store the results in your database.

提交回复
热议问题