0
votes

I want to get some data from .mdb but I get an exception on WinXP machine. There is MDAC 2.8 alrdy installed. Is there way to solve my problem without changing DB type? Method to get data.:

private void GetDatafromDB(){
        int counter = 0;
        string _sql = "select * from template where 1=1";
        OleDbDataReader reader = ldb.ReadList(_sql);
                while (reader.Read())
                {

                    if (reader[1] is DBNull)
                        continue;
                     this.t0 = reader[0].ToString();//autoid
                     this.t1 = reader[1].ToString();//real name
                     this.t2 = reader[2].ToString();//userid
                     this.t3 = reader[3].ToString();//fingerindex
                     this.t4 = reader[4].ToString();//rights
                     this.t5 = reader[5].ToString();//base64  template_9


                    //int autoid = (int)reader[0];
                    byte[] tmp = Convert.FromBase64String(this.t5);
                    zkfp2.DBAdd(mDBHandle, Int32.Parse(t3), tmp);
                    counter++;
          }
          textTips.AppendText("Loaded "+ counter +" fingerprints \r\n");
    }

Exception:

************** Exception Text **************

System.Data.OleDb.OleDbException: Selected collating sequence not supported by the operating system. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at WindowsFormsApp1.LocalDb.ReadList(String SQL) in c:\Users\user\Desktop\fingerprint WINxp\WindowsFormsApp1\LocalDb.cs:line 132 at WindowsFormsApp1.Form1.GetDatafromDB() in c:\Users\user\Desktop\fingerprint WINxp\WindowsFormsApp1\Form1.cs:line 362 at WindowsFormsApp1.Form1.connDevice_Click(Object sender, EventArgs e) in c:\Users\user\Desktop\fingerprint WINxp\WindowsFormsApp1\Form1.cs:line 354 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

1
Do any of your tables lack a unique key index?John Wu
@JohnWu I have only one table with one unique key index - IDLittle Fox

1 Answers

0
votes

The problem was that target machine has another system language and .mdb file has been created on another one. Creating new database on target machine - solved my question.

Source - http://www.cnblogs.com/zoupeiyang/archive/2009/03/11/1408741.html