提前可能很重要的信息:
Access 2003 Database (*.mdb)
Table is Linked to SQL Server 2005 Database --> Table
When linked to another Access Database --> Table it works
Program which i use to update : .net 2.0 based C#
Databaselanguage: German?
OleDbConnection used:
Connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + PathToDatabase + ";" +
"Jet OLEDB:System Database=" + PathToSystemFile+ ";" +
"User ID=" + SignedUserID + ";" +
"Password=" + SignedLoginKey + ";");
问题:
我想更新一个字符串,我已成功解析为SQL-Update语句,如:
UPDATE [Artikel] SET [Artikelbeschreibung]='УБИТЬ ДРОЗДА 4 СЕРИИ' WHERE products_id=32501;
我的表[Artikel]包含符合要求的行(products_id = 32501) 当我更新字符串时,没有抛出的错误或异常。 当我检查数据库中的内容时,我只看到这个:
????? ?????? 4 ?????
来自文件的编码是UTF8,我已经尝试过但没有运气:Convert ANSI (Windows 1252) to UTF8 in C#
这是我的程序所做的步骤:
1. Load a file containing the sql statement with placeholder / information in which file, which section, which key the right information will be
EXAMPLE: UPDATE [Artikel] SET [Artikelbeschreibung]='<<C:\myfile.ini::MySection::MyKey>>' WHERE products_id=32501;
2. Grab Placeholder / Information
NOW I HAVE: <<C:\myfile.ini::MySection::MyKey>>
3. Parse, open File, Search for Section, Search for Key, responding Value of Key as String
RESPONSE = УБИТЬ ДРОЗДА 4 СЕРИИ
4. Replace <<C:\myfile.ini::MySection::MyKey>> with УБИТЬ ДРОЗДА 4 СЕРИИ in Original SQL Statement
RESULT: UPDATE [Artikel] SET [Artikelbeschreibung]='УБИТЬ ДРОЗДА 4 СЕРИИ' WHERE products_id=32501;
5. Take the string with the Result, open OleDbConnection with Connection as described above and
do this:
Connection.Open();
if (Connection != null)
{
Command = null;
Command = Connection.CreateCommand();
Command.CommandText = SQL;
Command.ExecuteNonQuery();
Connection.Close();
Connection = null;
}
6. Looking into my Database there is only '????? ?????? 4 ?????' instead of 'УБИТЬ ДРОЗДА 4 СЕРИИ'
Additional Informations: This Only occurs when my Table is linked to a SQL Server, when Table is linked to another Database or is Database directly it works fine.
也许有人可以帮助我,我不知道错误可能在哪里。
如果需要更多信息,请写信,我会尽快通过&#34;编辑&#34;
尝试这些文件答案 0 :(得分:0)
您有两种选择:
转到Regional Options
并将非Unicode程序的区域设置设置为使用西里尔字符的区域设置。
将西里尔字符串转换为unicode
UnicodeFromVal
应设置西里尔字母表中第一个Unicode字符的值。
Public Function AsUnicode(ByVal Source As String, UnicodeFromVal As Long) As String
Dim c As Long
Dim ByteString() As Byte
Dim AnsiValue As Integer
Dim Length As Long
Length = Len(Source)
ByteString = StrConv(Source, vbFromUnicode, GetSystemDefaultLCID())
For c = LBound(ByteString) To UBound(ByteString)
AnsiValue = ByteString(c)
If AnsiValue >= 224 And AnsiValue <= 250 Then
AsUnicode= AsUnicode & ChrW(CLng(AnsiValue - 224 + UnicodeFromVal))
Else
AsUnicode= AsUnicode & ChrW(AnsiValue)
End If
Next
End Function