将文本文件数据导入到SQL Server时出现问题
大家好,
我正在将一些数据从文本文件导入VB.Net中的sql server.
数据包含一些德语字母.
因此,当我在sql中签入数据时,导入这些数据后,这些德语字母被替换为一些奇怪的字符.
谁能告诉我如何处理这种情况.
我发现类似Unicode的东西,但不知道如何实现.
-------更新-----------
我发现我需要这样做:
Hello All,
I am importing some data from a text file to sql server in VB.Net.
The data contains some german alphabets.
So, after importing data when i check in sql, those german alphabets got replaced by some weird characters.
Can anybody tell me how can i handle this situation.
I found something like Unicode Compliant, but did not know how to achieve it.
-------Update-----------
I found that i need to do this:
insert into tblname(col1,col2) values(N''value1'',N''Value'')
我手动尝试过,它正在工作.
但是我在SqlCommand中使用SqlParameters插入数据,所以我不能给出这种格式.
谁能告诉我如何做到这一点?
--------更新------------
-------- Update2 ------------
表中字段的数据类型为nvarchar(30),而我的参数数据类型也为nvarchar(30).
-------- Update2 ------------
谢谢,
Nagendra.
I tried manually and it is working.
But i am using SqlParameters in SqlCommand to insert data, so i can not give such format.
Can anyone tell me how can i achieve this?
--------Update------------
--------Update2------------
Datatype of field in table is nvarchar(30) and my parameter datatype is also nvarchar(30).
--------Update2------------
Thanks,
Nagendra.
尝试以下代码行
Try the below line of code
comm.Parameters.Add("@name", System.Data.SqlDbType.NVarChar).Value
还要检查此链接 [
Also check this link[^] for reference.