打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
VFB_测试sqlite3类
 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command1_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
If SQLite31.Open(App.Path "sqlite3_test.db", ""False Then
        Print 
"打开数据库成功"
    Else
        Print 
"打开数据库失败 SQLite31.ErrMsg
    End If
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command2_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
If SQLite31.SetKey("123456"False Then Print SQLite31.ErrMsg
    Print "修改密码"
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command3_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim rs() As String
    Dim 
As Long SQLite31.SqlFind("SELECT FROM features WHERE id=100", rs())
    
Dim As Long x,y
    If Then Print SQLite31.ErrMsg
    Print UBound(rs), UBound(rs, 2)
    
For To UBoundrs)
        
For To UBound(rs, 2)
            
Print rs(y, x ,
        
Next
        Print
    Next
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command4_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim rs() As String
    Dim 
As Long SQLite31.Find("features", "id>0", rs())
    
Dim As Long x,y
    If Then Print SQLite31.ErrMsg
    Print UBound(rs), UBound(rs, 2)
    
For To UBoundrs)
        
For To UBound(rs, 2)
            
Print Utf8toStr(rs(y, x)),
        
Next
        Print
    Next
    
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command5_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim rs() As String
    Dim 
As Long SQLite31.FindOne("features", "id=2", rs())
    
Dim As Long x,y
    If Then Print SQLite31.ErrMsg
    Print "字段数:UBound(rs1
    For To UBound(rs)
        
Print Utf8toStr(rs(x))
    
Next
    Print
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command6_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
If SQLite31.SetKey(""False Then Print SQLite31.ErrMsg
    Print "清除密码"
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command7_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Print SQLite31.AddItem ("features", "title=100,description='dd''d'")
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command8_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Print SQLite31.Update ("features","id=2", "description='更新内容'")
    
Print SQLite31.ErrMsg
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command9_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Print "数据库引擎版本:SQLite31.Version
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command10_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim rs() As String
    Dim 
As Long SQLite31.SqlFind("PRAGMA  table_info('features') ", rs())  features 为表名称
    
Dim As Long x,y
    If Then Print SQLite31.ErrMsg
    Print UBound(rs), UBound(rs, 2)
    
For To UBoundrs)
        
For To UBound(rs, 2)
            
Print Utf8toStr(rs(y, x)),
        
Next
        Print
    Next
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command11_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim rs() As String
    Print 
SQLite31.INIsetKey("软件配置", "测试项目", "测试值")
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command12_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim rs() As String
    Print 
SQLite31.INIgetKey("软件配置", "测试项目", "默认值")
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command13_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim rs() As String
    Dim 
id As Long SQLite31.MaxID("features", "id")
    
If id Then
        Print 
SQLite31.ErrMsg
    Else
        Print 
"删除ID=id
        Print SQLite31.DeleteItem("features", "id=id)
    
End If
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command14_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Print SQLite31.Count("features")
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command15_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim id As Long SQLite31.AddItem("[二进制]", "aaa=100"  '为了避免表名称或字段名称与SQL内部名称冲突,可以用[] 括在中间,中文更应该括起来
    
If id Then
        Print 
"出错:SQLite31.ErrMsg
    Else
        Dim 
by(10As UByte
        For As Long To 10
            by(iInt(Rnd 255)
            
Print Hex(by(i), 2" ;
        Next
        Print
        Print 
SQLite31.UpdateByte("[二进制]", "ID=id, "[数据]", @by(0), 11 '为了避免表名称或字段名称与SQL内部名称冲突,可以用[] 括在中间,中文更应该括起来
        
Print "出错:SQLite31.ErrMsg
    End If
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command16_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Dim rs() As String
    Dim 
As Long SQLite31.Find("[二进制]", "", rs()) '为了避免表名称或字段名称与SQL内部名称冲突,可以用[] 括在中间,中文更应该括起来
    
Dim As Long x,y ,i
    If Then Print SQLite31.ErrMsg
    Print UBound(rs), UBound(rs, 2)
    
For To UBoundrs)
        
For To UBound(rs, 2)
            
If And Then
                Dim 
ss As String
                For 
To Len(rs(y, x)) 1
                    ss  Hex(rs(y, x)[i], 2"    String 可以包含任意值,当然可以是2进制数据了
                
Next
                Print 
ss,
            Else
                Print 
rs(y, x),
            
End If
        Next
        Print
    Next
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command17_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Print SQLite31.Vacuum
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command18_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
SQLite31.TransactionBegin   事务开始(用于批量执行SQL,提高SQL效率)
    
Dim As Long
    
For To 100
        SQLite31.AddItem("features", "title=",description='Rnd "'")
    
Next
    Print 
SQLite31.TransactionEnd 事务执行并且结束
    
Print "ok"
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command19_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Print SQLite31.CreateTable("[创建的新表]")
    
Print "出错:SQLite31.ErrMsg
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command20_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Print SQLite31.AddField("[创建的新表]", "[新字段]", "TEXT","'dd'")
    
Print "出错:SQLite31.ErrMsg
End Sub

 单击 [事件]   ControlIndex=控件数组的索引  hWndForm=窗体句柄  hWndControl=控件句柄  ionControl=按钮的标识符
Sub Form1_Command21_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd '单击
    
Print SQLite31.CreateIndex("[创建的新表]", "[新字段]", True)
    
Print "出错:SQLite31.ErrMsg
End Sub

Sub 
Form1_Shown(hWndForm As hWnd,UserData As Integer)  '窗口完全显示后。UserData 来自显示窗口最后1个参数。
End Sub
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
SendMessage函数的常用消息及其应用大全
Duilib
定制化窗体之放大镜
使用VB根据句柄获得一个程序的窗口大小
按键精灵-多线程多开例子
VC++中有关句柄和指针及其转换
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服