简体   繁体   中英

Excel import through ADO.Net in C#

Anybody please help me I am unable to import Excel file data in SQL Server Database . The excel file data is in multi languages the data which is in English is uploaded properly but the data which is in other language is readed but in an encoded format.

Please, let me know how can I import multi language excel file in database?

Not sure about collation used for datatable in SQL server. You may need to update data type for imported data table in SQL server to support different encodings. Make use of nvarchar data type for column for which different language input expected.

You can do on non primary key fields:

ALTER TABLE [TableName]
ALTER COLUMN [ColumnName] nvarchar(N) null

On the primary key fields it will not work - you will have to recreate the table.

Make sure that the length doesn't exceed 4000 since the maximum for VARCHAR is 8000 while NVARCHAR is only 4K

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