数据库
首页 > 数据库> > 在.net 4.0中使用SQLite的内存数据库

在.net 4.0中使用SQLite的内存数据库

作者:互联网

原文链接:http://www.cnblogs.com/hzb2001/archive/2011/06/08/2075505.html 在app.config中修改:  <startup useLegacyV2RuntimeActivationPolicy="true">    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />

  </startup> 

 

然后: 

        Dim SQLconnect As New SQLite.SQLiteConnection()

        Dim SQLcommand As SQLiteCommand        SQLconnect.ConnectionString = "Data Source=:memory:;Version=3;New=true"        SQLconnect.Open()        SQLcommand = SQLconnect.CreateCommand        SQLcommand.CommandText = "CREATE TABLE foo(title TEXT, description TEXT)"        SQLcommand.ExecuteNonQuery()        SQLcommand.CommandText = "INSERT INTO foo (title, description) VALUES ('This is a title', 'This is a Description')"        SQLcommand.ExecuteNonQuery()        SQLcommand.CommandText = "SELECT * FROM foo"        Dim SQLreader As SQLiteDataReader = SQLcommand.ExecuteReader()        While SQLreader.Read()            MessageBox.Show(SQLreader.Item(0).ToString)        End While        SQLcommand.Dispose()        SQLconnect.Close()

转载于:https://www.cnblogs.com/hzb2001/archive/2011/06/08/2075505.html

标签:Dim,SQLite,4.0,title,SQLconnect,net,foo,SQLcommand,CommandText
来源: https://blog.csdn.net/weixin_30701575/article/details/98251752