没有';t查找错误:Can';t使用西里尔字母更新MDB Tablerow

本文关键字:Tablerow MDB 更新 错误 查找 Can 没有 | 更新日期: 2023-09-27 18:20:22

提前可能很重要的信息:

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 [Artikel] SET [Artikelbeschreibung]='УБИТЬ ДРОЗДА 4 СЕРИИ' WHERE products_id=32501;

我的表[Artikel]包含一行满足要求(products_id=32501)当我更新字符串时,没有抛出任何错误或异常。当我检查数据库中的内容时,我只看到以下内容:

????? ?????? 4 ?????

文件编码是UTF8,我已经尝试过了,但没有成功:在C#中将ANSI(Windows 1252)转换为UTF8

我的程序的步骤如下:

 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.

也许有人可以帮我,我不知道错误可能在哪里。

如果需要更多信息,请写下,我会尽快通过"编辑"

没有';t查找错误:Can';t使用西里尔字母更新MDB Tablerow

尝试此类文档

您有两个选项:

  1. 转到Regional Options,将非Unicode程序的区域设置为使用西里尔字母的区域设置。

  2. 将西里尔字母字符串转换为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