dcsimg
Results 1 to 16 of 16

Thread: SQLite examples for vbRichClient?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2014
    Location
    Ohio
    Posts
    122

    SQLite examples for vbRichClient?

    I would love to use this great lib for a project I'm working on, but I can't find any examples of its use. I looked on vbrichclient.com and there are some great Cairo samples, but I couldn't find anything for SQLite, how to open a DB, etc. How am I missing it? I know it's suppose to be based on ADO, so it should be easy-to-use, but having a working starter project and DB to play with is always nice. I found a sample on PSC that uses vbRichClient3, but I couldn't get it to work with the latest vbRichClient.

  2. #2
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,329

    Re: SQLite examples for vbRichClient?

    When you search this Forum for SQLite, you should find quite some postings with Demo-Projects and Links.
    Here's one, which shows what's in the largest of these Demos (the "Nwind"-based one, which covers nearly everything).
    http://www.vbforums.com/showthread.p...=1#post4627999

    Olaf

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2014
    Location
    Ohio
    Posts
    122

    Re: SQLite examples for vbRichClient?

    Fantastic. Thank you! I had search on here too, but the results were mixed, so it was hard to find anything. I don't know if I'm searching incorrectly or what.

  4. #4
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,297

    Re: SQLite examples for vbRichClient?

    You've made a good choice If you run into any specific problems, start a new thread mentioning RC5 in your subject line and we'll do our best to help (there are quite a few vbRichClient5 users at this forum).

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2014
    Location
    Ohio
    Posts
    122

    Re: SQLite examples for vbRichClient?

    I forgot to ask. Would you happen to have an example for a DB browser that opens any SQLite DB and view its various tables, fields, etc?

  6. #6
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,512

    Re: SQLite examples for vbRichClient?

    There are multiple.

    Old, but my favorite:
    http://www.singular.gr/sqlite/

    Alternatives:
    http://alternativeto.net/software/sqlite-manager/

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2014
    Location
    Ohio
    Posts
    122

    Re: SQLite examples for vbRichClient?

    Sorry, I meant a DB browser example that users Mr. Schmidt's vbRichClient5.

  8. #8
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,329

    Re: SQLite examples for vbRichClient?

    Quote Originally Posted by CrazyDude View Post
    Sorry, I meant a DB browser example that users Mr. Schmidt's vbRichClient5.
    AFAIK there's none currently...

    But the DB-ObjectModel-Classes should make it quite easy, to write a nice one with relatively low efforts...

    cConnection
    ...cDataBases (there can be more than one attached to the Cnn)
    ......cDataBase
    .........cTables
    ............cTable
    ...............cColumns
    ..................cColumn
    ...............cIndexes
    ..................cIndex
    .........cViews
    ............cView

    The above Objects with a trailing '...s' are List-Objects (enumerable with For Each).

    For code wich makes (partially) use of them, you can take a look into the above linked 'NWind-Demo':
    - the SQLite-NWind-Performance-Form fills its Table- and View-ListBoxes this way
    - and then there's also a small View-Editor-Form included

    Both could be a good start, to write a more complete (TreeView-based) little SQLite-Manager-App...

    Never wrote one for my own usage, because SQLites FieldType-System is not very large:
    - AutoSizing Integers (FieldType-Name: Integer)
    - Autosizing Strings (FieldType-Name: Text)
    - Rational-Numbers (FieldType-Name: Double)
    - Date+Time (FieldType-Name: DateTime)
    - Short-Dates (FieldType-Name: ShortDate)
    - Booleans (FieldType-Name: Boolean or Bit)
    - Binary-Data (FieldType-Name: Blob)

    ...so, pretty concise and it's relatively effortless to define the DB-Schema per VB-Code
    (over SQL-DDL-Executes)... Starting out already this way, makes it also easier to maintain
    and enhance an existing DB-Schema dynamically later on, in some future App-Updates...

    Olaf
    Last edited by Schmidt; Apr 12th, 2016 at 05:50 PM.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2014
    Location
    Ohio
    Posts
    122

    Re: SQLite examples for vbRichClient?

    Thank you so much Olaf. I agree, this should definitely be enough to get me going. I really only need to read from a SQLite DB for now, except just about 2 million of them. And thank you for a great well-thought out lib. I've been looking at the properties/methods in the Nwind project and you really have a lot in that lib. A DB conversion method built in? Wunderbar!

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Feb 2014
    Location
    Ohio
    Posts
    122

    Re: SQLite examples for vbRichClient?

    Quote Originally Posted by jpbro View Post
    You've made a good choice If you run into any specific problems, start a new thread mentioning RC5 in your subject line and we'll do our best to help (there are quite a few vbRichClient5 users at this forum).
    Thank you bro! I know I have! And if I run into a problem, I'll post. I could possibly even use some paid help on this, but I don't know who'd be interested and available.

  11. #11
    Member oldVBDev's Avatar
    Join Date
    Aug 2018
    Posts
    56

    Re: SQLite examples for vbRichClient?

    Hello. Someone has an example of using the l function
    "openschema" by CConnection with a sqlite db.
    Thanks

  12. #12
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,297

    Re: SQLite examples for vbRichClient?

    OpenSchema is a shortcut to opening a read-only cRecordset object with the following SQL: "SELECT * from sqlite_master". The sqlite_master table is a system table that has information about all of the tables, indexes, triggers, etc... in the database. It is opened read-only because you really shouldn't be horsing about in there

    Here's some info about the sqlite_master table from the sqlite.org FAQ :

    (7) How do I list all tables/indices contained in an SQLite database

    If you are running the sqlite3 command-line access program you can type ".tables" to get a list of all tables. Or you can type ".schema" to see the complete database schema including all tables and indices. Either of these commands can be followed by a LIKE pattern that will restrict the tables that are displayed.

    From within a C/C++ program (or a script using Tcl/Ruby/Perl/Python bindings) you can get access to table and index names by doing a SELECT on a special table named "SQLITE_MASTER". Every SQLite database has an SQLITE_MASTER table that defines the schema for the database. The SQLITE_MASTER table looks like this:

    CREATE TABLE sqlite_master (
    type TEXT,
    name TEXT,
    tbl_name TEXT,
    rootpage INTEGER,
    sql TEXT
    );

    For tables, the type field will always be 'table' and the name field will be the name of the table. So to get a list of all tables in the database, use the following SELECT command:

    SELECT name FROM sqlite_master
    WHERE type='table'
    ORDER BY name;

    For indices, type is equal to 'index', name is the name of the index and tbl_name is the name of the table to which the index belongs. For both tables and indices, the sql field is the text of the original CREATE TABLE or CREATE INDEX statement that created the table or index. For automatically created indices (used to implement the PRIMARY KEY or UNIQUE constraints) the sql field is NULL.

    The SQLITE_MASTER table is read-only. You cannot change this table using UPDATE, INSERT, or DELETE. The table is automatically updated by CREATE TABLE, CREATE INDEX, DROP TABLE, and DROP INDEX commands.

    Temporary tables do not appear in the SQLITE_MASTER table. Temporary tables and their indices and triggers occur in another special table named SQLITE_TEMP_MASTER. SQLITE_TEMP_MASTER works just like SQLITE_MASTER except that it is only visible to the application that created the temporary tables. To get a list of all table

  13. #13
    Member oldVBDev's Avatar
    Join Date
    Aug 2018
    Posts
    56

    Re: SQLite examples for vbRichClient?

    Many thanks

  14. #14
    New Member
    Join Date
    Jul 2019
    Posts
    2

    Re: SQLite examples for vbRichClient?

    I am trying to migrate an application from access/dao to sqlite vbRichClient. I can read and execute simple queries from my converted database but any query with more than one inner join doesn't work. I can execute queries with four or five joins using "DB Browser for SQLite" but seemingly not with rich client.

    Thanks for any ideas!

  15. #15
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,297

    Re: SQLite examples for vbRichClient?

    Can you post an example Schema & Query for testing?

    e.g.

    Code:
    CREATE TABLE test (col1 INTEGER PRIMARY KEY, col2 TEXT);
    CREATE TABLE test2 (col1 INTEGER PRIMARY KEY, col2 TEXT, col3 INTEGER);
    CREATE TABLE test3 (col1 INTEGER PRIMARY KEY, col2 TEXT, col3 INTEGER);
    INSERT INTO test (col2) VALUES ('A')
    INSERT INTO test (col2) VALUES ('B');
    INSERT INTO test (col2) VALUES ('C');
    INSERT INTO test2 (col2) VALUES ('A');
    INSERT INTO test2 (col2) VALUES ('B');
    INSERT INTO test2 (col2) VALUES ('C');
    INSERT INTO test3 (col2) VALUES ('A');
    INSERT INTO test3 (col2) VALUES ('B');
    INSERT INTO test3 (col2) VALUES ('C');
    SELECT * FROM test INNER JOIN test2.col3 ON test.col1, etc.....
    Last edited by jpbro; Jul 31st, 2019 at 12:58 PM. Reason: Added example

  16. #16
    New Member
    Join Date
    Jul 2019
    Posts
    2

    Re: SQLite examples for vbRichClient?

    Never mind... was using the older "dhSQLite.dll" and wasn't paying attention as the db classes seem to be the same.

    Thanks for the quick response!

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width