开发者

How to use System.Data.SQLite under mono?

开发者 https://www.devze.com 2023-01-02 02:05 出处:网络
I downloaded System.Data.SQLite, and tried to compile the following sample code. using System; using System.Data;

I downloaded System.Data.SQLite, and tried to compile the following sample code.

using System;
using System.Data;
using System.Data.Common;
using System.Data.SQLite;

namespace test
{
  class Program
  {
    static void Main(string[] args)
    {
      SQLiteConnection.CreateFile("/Users/smcho/Desktop/SQLite-1/example/mydatabasefile.db3");
    }
  }
}

I ran the following command

mcs db.cs -r:System.Data.dll -r:System.Data.SQLite.dll

But, I got the error messages as follows.

** (/opt/local/lib/mono/1.0/mcs.exe:43249): WARNING **: The class System.Data.Common.DbConnection could not be loaded, used in System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
db.cs(12,7): error CS0103: The name `SQLiteConnection' does not exist in the current context
Compilation failed: 开发者_如何学JAVA1 error(s), 0 warnings

What might be wrong?


Using the gmcs instead of mcs solved this issue.

gmcs db.cs -r:System.Data.dll,System.Data.SQLite.dll
0

精彩评论

暂无评论...
验证码 换一张
取 消