从c#打开Android数据库:“目前只支持SQLite版本3”;NotSupportedException.由于

本文关键字:版本 SQLite 目前只支持 由于 NotSupportedException 支持 Android 打开 数据库 目前 | 更新日期: 2023-09-27 17:50:55

我正在尝试连接并从android (sqlite)数据库读取,从c#应用程序(VS2010 Pro)。我尝试了不同版本的System.Data.SQLite.dll(用于。net 3.5, x86/。net 4.0 on x64)。但是我还是不能讨论这个异常:

*System.NotSupportedException was unhandled
 HResult=-2146233067
 Message=Only SQLite Version 3 is supported at this time
 Source=System.Data.SQLite
 StackTrace:
   at System.Data.SQLite.SQLiteConnection.Open()
   at ConsoleApplication1.Program.Main(String[] args) in   C:'Users'lucian.teodorescu'documents'visual studio 2010'Projects'ConsoleApplication1'ConsoleApplication1'Program.cs:line 18
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

InnerException: *

我的代码是:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data.SQLite;
    using System.Data;
    namespace ConsoleApplication1
    {
    class Program
     { 
      static void Main(string[] args)
      {
        SQLiteConnection m_dbConnection;
        m_dbConnection = new SQLiteConnection("Data Source=''''192.xxx.xx.xxx:5555''data''data''MyApp''sqlite_db''AUTOMATICTEST''W1579_W2PR_QA_R13.db;Version=0;");
      //m_dbConnection = new SQLiteConnection("Data  Source=L:''Lucian''workspace''W1579_W2PR_QA_R13.db;Version=0;");
        m_dbConnection.Open();
        string sql = "select * from SSS_CUSTOMER WHERE customer_number01 = 90685";
        SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
        Console.WriteLine(sql);
       }
     }
    }

查看源代码,在第823行,我发现了这个,但我仍然不明白:

    if (Convert.ToInt32(FindKey(opts, "Version", "3"), CultureInfo.InvariantCulture) != 3)
    throw new NotSupportedException("Only SQLite Version 3 is supported at this time");

必须做什么来克服这个异常?

从c#打开Android数据库:“目前只支持SQLite版本3”;NotSupportedException.由于

连接字符串中的Version=3已经修复了这个问题。新的连接字符串是:

m_dbConnection = new SQLiteConnection("Data Source=''''192.xxx.xx.xxx:5555''data''data''MyApp''sqlite_db''AUTOMATICTEST''W1579_W2PR_Q‌​A_R13.db;Version=3;");