简体   繁体   中英

How to import data from Excel to SQL in C#

I have this reference on how to import data from excel to SQL using C# Console. The problem is I am getting errors because of the html tags (not sure though, ex. ). Even if I have added the Bytescout.Spreadsheet Reference needed, still errors occur. Please help me to make this work. https://bytescout.com/products/developer/spreadsheetsdk/xls-to-sql-vbnet-csharp.html Thank you so much.

use import export wizard like this:

在此处输入图片说明

The page has a small HTML error on it so as a result you just need to remove all the "" to the end of items that arent relevant to make code you can read.

such as " using (<span data-scayt_word="SqlConnection" data-scaytid="17">SqlConnection</span> connection = new <span data-scayt_word="SqlConnection" data-scaytid="18">SqlConnection</span>(<span data-scayt_word="connectionString" data-scaytid="15">connectionString</span>) " turns to

" using (SqlConnection connection = new SqlConnection(connectionString) "

the latter of course is far more likely to work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM