Dim ModuleSql As String

Dim n As Integer

'SQLite連線
Dim connSQLite As New Data.SQLite.SQLiteConnection
Dim CmdSQLite As New Data.SQLite.SQLiteCommand '定义一个SQL操作
Dim drSQLite As Data.SQLite.SQLiteDataReader

Public Sub Open_SQLite() '打开SQLite連線
connSQLite.ConnectionString = "Data Source=資料庫"
connSQLite.Open() '数据库连接
CmdSQLite.Connection = connSQLite
CmdSQLite.CommandType = CommandType.Text
CmdSQLite.CommandText = ModuleSql
drSQLite = CmdSQLite.ExecuteReader

End Sub

Public Sub Close_SQLite() '关闭SQLite連線
CmdSQLite.Dispose()
connSQLite.Close()
End Sub

ModuleSql = "delete from T1"'刪除
Open_SQLite()
Close_SQLite()

ModuleSql = ("Select COUNT(*) From T1 WHERE (A1 LIKE '" & TextBox1.Text & "')")'查詢
Open_SQLite()
drSQLite.Read()
n = drSQLite.Item(0)
Close_SQLite()

1、下载正确版本的SQLite,主要是32位还是64位

2、将SQLite.Interop.dll和System.Data.SQLite.dll放到bin文件夹的debug文件夹下,然后只需引用System.Data.SQLite.dll就好

3、将项目属性里面的生成里面的平台目标改成x64,当然这是因为我电脑是64位的,如果是32位电脑也许不用这步操作了。

Sub vacuum() '壓縮SQLite資料庫
Dim connection As New SQLite.SQLiteConnection("Data Source=VB1.db")
connection.Open()
Dim oMainQueryR As New SQLite.SQLiteCommand
oMainQueryR = New SQLite.SQLiteCommand
oMainQueryR.Connection = connection
oMainQueryR.CommandText = ("vacuum")
oMainQueryR.ExecuteNonQuery()
connection.Close()
End Sub

vb.net 與 SQLite連線的更多相关文章

  1. 在 Windows 上遇到非常多 TIME_WAIT 連線時應如何處理

        我們公司所代管的網站裡,有幾個流量是非常大的,在尖峰的時刻同時上線人數可能高達數千到數萬人,而在這個時候如果使用 netstat 或 TCPView 查看所有 TCP 連線時就會看到非常多處於 ...

  2. Ubuntu 14 設定 遠端連線,讓別台電腦可以連線進來

    Ubuntu 14 需 disable 加密,方可 遠端連線 此台電腦 xxx@xxx-ThinkPad-T460p:~$ gsettings set org.gnome.Vino require-e ...

  3. NB實體連線到公司的網路,無法上網解決方案,需設 proxy。

    未使用 VPN Cisco Anyconnect 已連線到公司的網路: google-chrome-stable --proxy-server="proxy.XXXcomm.com:3128 ...

  4. [ Windows] [ OS ] [ Remote Desktop ] 開啟同一個帳號同時2的連線RDP的方式

    感謝同事 Allen 的Support :) 執行>gpedit.msc 電腦設定>Windows元件>遠端桌面服務>遠端桌面工作階段主機>連線>限制遠端桌面服務的 ...

  5. Iptables網路連線限制及攻擊防護和相關設定

    [筆記整理]Iptables網路連線限制及攻擊防護和相關設定 1. 限制每個IP連接HTTP最大併發50個連接數 iptables -A INPUT -p tcp --dport 80 -m conn ...

  6. VB.NET 使用ADODB連接資料庫滙出到EXCEL

    '導入命名空間 Imports ADODB Imports Microsoft.Office.Interop Private Sub A1() Dim Sql As StringDim Cnn As ...

  7. 如何讓 iOS UIWebView 連線時傳送自訂 Cookie 的方法[转]

    利用 NSHTTPCookieStorage 管理 Cookie 傳送 在 iOS 中如果自行建立 UIWebView 來開啟遠端站台資料,這時可以透過以下方法加入 Cookie.原理是透過 iOS ...

  8. (图文实例)用VB.net操作SQLite数据库

    转载请注明出处:HateMath归来(http://www.cnblogs.com/hatemath/) 环境: Visual Studio 社区版 64位 Windows 7系统 新建的解决方案基于 ...

  9. Browser 與 Server 持續同步的作法介紹 (Polling, Comet, Long Polling, WebSocket)长连接

    對 Comet 的懵懂 記得兩年多前,第一次看到 Gmail 中的 GTalk 覺得很好奇:「咦?線上聊天且是 Google 的熱門系統,只用傳統的 AJAX 應該會操爆伺服器吧?」很幸運的,當時前公 ...

随机推荐

  1. js读取txt文件

    $('#selectAreaFile').on('change',function(e){//用户区域的文件选择        var files=e.target.files;        if ...

  2. python 从基础到入门链接

    机器学习篇: 先看的 简书 木子昭的机器学习三剑客 : https://www.jianshu.com/u/c5d047065c42 然后看完之后又发现一个很好的链接, nkwy2012博主提供了很多 ...

  3. Azure Active Directory document ---reading notes

    微软利用本地活动目录 Windows Server Active Directory 进行身份认证管理方面具有丰富的经验,现在这一优势已延伸基于云平台的Azure Active Directory.可 ...

  4. 背水一战 Windows 10 (93) - 选取器: FileOpenPicker, FolderPicker, FileSavePicker

    [源码下载] 背水一战 Windows 10 (93) - 选取器: FileOpenPicker, FolderPicker, FileSavePicker 作者:webabcd 介绍背水一战 Wi ...

  5. [转]Kaldi命令词识别

    转自: http://www.jianshu.com/p/5b19605792ab?utm_campaign=maleskine&utm_content=note&utm_medium ...

  6. Spring源码追踪1——doGetBean(为什么org.springframework.data.redis.core.RedisTemplate的实例可以注入为ListOperations)

    类org.springframework.beans.factory.support.AbstractBeanFactory方法T doGetBean(final String name, final ...

  7. Android精通之AsyncTask与ListView讲解

    版权声明:未经博主允许不得转载 AsyncTask 了解AsyncTask异步,需要了解一下异步任务(多线程),什么是线程,可以这么说线程好比边吃饭边看电视,AsyncTask是为了方便后台线程中操作 ...

  8. 机器学习入门06 - 训练集和测试集 (Training and Test Sets)

    原文链接:https://developers.google.com/machine-learning/crash-course/training-and-test-sets 测试集是用于评估根据训练 ...

  9. Python中的高级变量类型

    高级变量类型 目标 列表 元组 字典 字符串 公共方法 变量高级 知识点回顾 Python 中数据类型可以分为 数字型 和 非数字型 数字型 整型 (int) 浮点型(float) 布尔型(bool) ...

  10. 关于 Spring Security OAuth2 中 Feign 调用 Token 问题

    微服务体系中,避免不了服务之间链式调用,一般使用 Feign ,由于使用 Spring Security OAuth2 全局做了安全认证,简单的一种实现方式就是在服务提供方获得 Token 再次通过 ...