• Welcome to SQLitening Support Forum.
 

Integer Primary Key AutoIncrement and inserting a new record

Started by Bern Ertl, December 16, 2008, 05:29:24 PM

Previous topic - Next topic

Bern Ertl

I'm working on a small program and exploring SQLitening/SQLite.  My program creates a local database with a single table and twelve columns, one of which LicenseID is specified as "Integer Primary Key Autoincrement".

I use the following to insert a record into the database (only one field is defined):

slExe slBuildInsertOrupdate("Licenses", BYCOPY zVal, BYCOPY zCol)

zCol is specifying a column other than the LicenseID column.

How can I easily determine what LicenseID is being assigned to the new record?

JoeByrne

do an slGetInsertID right after your update/insert.  This returns the value of the index column.

Bern Ertl

lol... It's almost like someone else thought about this before...  :-[

Bear with me... I'll learn this command set before too long.  :)

JoeByrne

Bern,

You're not that far behind me!  Really, I've written/converted a couple of apps over now using SQLitening but I've only been going at it for a few months myself.  Like most well designed things though, when the chips start falling into place, it gets much easier!

One additional tool I hadn't really used in the past but now see the enormous benefit of, is the grid control.  If you haven't used one in your arsenal yet, I highly recommend you give MLG a look-see.  I purchased siGrid and EGrid as well, but they both have far more capabilities (and complexities) than I needed (or need so far).  MLG on the other hand was designed in a big way to support SQL databases.  Its far superior to a listview control and extremely easy to incorporate with SQLitening.  Plus its just a few clicks up on this forum :)

Bern Ertl

Thanks.  I've been using FarPoint's Spread for several years now and am comfortable with it, but I'll have a look at the MLG tool.