C#连接sqlite的代码,有人会吗?谢谢。

解决方案 »

  1.   

    需要一个SQLite的引擎啊,有个System.Data.SQLite,添加到项目引用之后就可以用了,给你个简单的参考:
                SQLiteConnection mycon = new SQLiteConnection(@"data source=db\Person.db3");
                mycon.Open();
                SQLiteCommand cmd = mycon.CreateCommand();
                cmd.CommandText = @"select * from person";
                SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill(ds);
                dataGridView1.DataSource = ds.Tables[0];
                mycon.Close();
      

  2.   

    System.Data.SQLite  在包里面没有,怎么办,是我没装好VS还是什么,怎样加这个包
      

  3.   

    下载一个System.Data.SQLite.dll文件然后从VS里引用到项目里,这样就可以USING System.Data.SQLite了