Gambas sqlite

Post Reply
Posts: 2
Joined: Tuesday 26th September 2017 12:55am

Gambas sqlite

Post by jessa » Wednesday 27th September 2017 8:22am

How to use sqlite in gambas? I'm using gambas in raspberry pi and DB browser for Sqlite.

Posts: 71
Joined: Monday 20th March 2017 6:06pm

Re: Gambas sqlite

Post by stevedee » Wednesday 27th September 2017 10:45am

Thats a big question, and I don't know how much you know about Gambas & Sqlite, but you will need to include the gb.db component and if you want to use Data Bound controls gb.db.form.

This is the simplest code I can think of to get you started;

Create a new project and add a textArea to the Form. Enter this text:-

Code: Select all

' Gambas class file

Private dbConnection As New Connection

Public Sub Form_Open()
Dim myTable As Table

  dbConnection.Name = "/home/steve/Gambas/my-tv/me-tv.db" 'the path to a valid database
  dbConnection.Type = "sqlite3"
  Try dbConnection.Open()
  ' display each database table name
  For Each myTable In dbConnection.Tables
    TextArea1.Text &= myTable.Name & gb.CrLf


When you run this code using a valid database, the textArea should list your database tables.

Posts: 2
Joined: Tuesday 26th September 2017 12:55am

Re: Gambas sqlite

Post by jessa » Thursday 28th September 2017 4:47am

Thank you very much! I'l try the code.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest