How to specify the delimiter when importing CSV files via OLEDB in C#

前端 未结 3 1776
你的背包
你的背包 2020-12-03 15:59

I need to perform a complex import in a Microsoft SQL Server 2000.

Since doing it in a DTS is too complicated, I\'m trying to do it with a little C# program, but I\'

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 16:31

    Commenter is right that you have your provider syntax the wrong way round.

    However, this isn't the problem. Unfortunately, you cannot specify a custom delimiter in your oledb connection string. Instead, create a schema.ini file in the same directory as your source file containing the following:

    [file.csv]
    Format=Delimited(;)
    

    Clumsy, but it does work.

提交回复
热议问题