• Welcome, Guest. Please login.
 
May 07, 2021, 11:08:46 PM

News:

Welcome to the SQLitening support forums!


Basic Use Q&A

Started by JoeByrne, July 26, 2008, 02:45:49 PM

Previous topic - Next topic

Fred Meier

Joe,

You are right, the current examples are not good for learning how to write
a complete application using SQLitening.  I will take the first cut at
doing a better one and post it in a new topic in a day or two. 

Your current error -19 is caused because the slBuildInsertOrUpdate
function is returning an Insert statement while you wanted an Update.
The last part of the error message probable reads...
      Statement = Insert into main .......

The slBuildInsertOrUpdate function takes four parms: Table, Values,
Columns, and Where.  All four are required for an update.  Your example
only passed two.  It is the fourth parm that determines if it's an Insert
or Update.  If it is omitted or empty then will build an Insert statement
else will build an Update statement appending " Where " and the Where
value. 

This example will result in an Update (only using two columns and made up the column names)

   slExe slBuildInsertOrUpdate("main",
                               RowID$ & $NUL & format$(OfficeID&&),
                               "ColNameRowID, ColNameOfficeID",
                               "RecKey = " & RowID$)


I agree that the doc is short.  If in doubt what the slBuildInsertOrUpdate is
returning, pass a copy of the slBuildInsertOrUpdate statment to msgbox so you
can see exactly what it builds.

JoeByrne

August 04, 2008, 01:14:37 AM #16 Last Edit: August 04, 2008, 01:50:30 AM by JoeByrne
Thanks Fred, I appreciate the help.

After studying the SQLite docs, I think I've figured out how the UPDATE command works, and for me, I think that's a better route than using the slBuildInsertOrUpdate function.  In this case particular, I will know for sure if the record is new or not, so it should be pretty straight forward to construct the proper SQLite statement.