Results 1 to 6 of 6

Thread: Open SQLite database (.sqlite file)

Threaded View

  1. #6
    New Member
    Join Date
    Jul 2018
    Posts
    4

    SQLitening example

    Code:
    Option Explicit 'https://sqlitening.planetsquires.com/index.php
    
    Sub InsertT1(s As String)
     Rem slsExe "insert into t values(null,'" + s + "')" 'no binding
     slsExeBind "insert into t values(null,?)", slsBuildBindDat(s, "T") 'bind as text
    End Sub
    
    Private Sub Form_Load()
     Dim x As Long
     ChDrive App.Path
     ChDir App.Path
     Caption = "Type SQL and press Enter"
     List1.TabStop = False
     Text1.Text = "select * from t"
     slsSetProcessMods "E1" 'E0=no errors,E1=show msgboxr,E2=show msgbox or crash, nothing crash
     slsOpen ":memory:"
     slsExe "create table t(c1 integer primary key,c2 text)"
     slsExe "Begin immediate"
     For x = 1 To 100
      InsertT1 "Insert success"
     Next
     slsExe "End"
     ShowRs
    End Sub
    
    Function ShowRs() As String
     Dim s As String, sql As String, colnum As Long, rownum As Long, columns As Long, rows As Long
     sql = Text1
     slsSel Text1
     columns = slsGetColumnCount
     If columns = 0 Then MsgBox "No columns returned: " + sql, , "Sqlite": Exit Function
     List1.Clear
     Do While slsGetRow
       rownum = rownum + 1
       s = ""
       For colnum = 1 To columns - 1
        s = s + slsF(colnum) + " | "
       Next
       s = s + slsF(colnum)
       List1.AddItem s
     Loop
     If rownum < 1 Then MsgBox "No rows returned: " + sql, , "Sqlite"
    End Function
    
    Private Sub Form_Resize()
     List1.Move 0, 0, ScaleWidth, ScaleHeight - Text1.Height + 20
     Text1.Move 0, List1.Top + List1.Height, ScaleWidth
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
     slsClose
    End Sub
    
    Private Sub Text1_KeyPress(KeyAscii As Integer)
     If KeyAscii = 13 Then KeyAscii = 0: ShowRs
    End Sub
    09/03/2023 10:15 AM 2,514 Form1.frm
    09/03/2023 08:57 AM 6,866 Module1.bas is sqlitenings.inc
    09/03/2023 10:15 AM 28,672 Project1.exe
    09/03/2023 10:15 AM 667 Project1.vbp
    09/03/2023 09:36 AM 84 Project1.vbw
    05/26/2023 08:45 AM 1,132,091 sqlite3.dll
    06/27/2023 09:21 PM 93,184 SQLitening.dll
    07/23/2021 04:46 PM 11,776 sqlitenings.dll
    Attached Images Attached Images  
    Last edited by gRens; Sep 3rd, 2023 at 10:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width