Prepared Statement Question

I have two questions about the Sqlite Prepared Statement code below to clear up some confusions.

  1. Does the add data type binding have to be in the same sequence as the Identify each type of data? (I figure it wouldn’t but I need to rule this out.)
  Listbox1.Cell(Listbox1.LastIndex, 0) = rs.Field("sCol_1").StringValue
  Listbox1.Cell(Listbox1.LastIndex, 1) = rs.Field("sCol_2").StringValue

   ps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT) // Out of sequence of the above
   ps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
  1. Does the ps.SQLExecute actually load the record into the database? I’m not sure if there needs to be more code to add the new row to the sqlite database.

[code]//Insert data in Listbox then in the database with a PreparedStatement
Dim ps As SQLitePreparedStatement = db.Prepare("INSERT INTO MyTable(sCol_1, sCol_2, iCol_1, iCol_2) VALUES(?, ?, ?, ?)

//Identify each type of data
Listbox1.Cell(Listbox1.LastIndex, 0) = rs.Field(“sCol_1”).StringValue
Listbox1.Cell(Listbox1.LastIndex, 1) = rs.Field(“sCol_2”).StringValue
Listbox1.Cell(Listbox1.LastIndex, 3) = Cstr(rs.Field(“iCol_1”).IntegerValue)
Listbox1.Cell(Listbox1.LastIndex, 4) = Cstr(rs.Field(“iCol_2”).IntegerValue)

//add the data type to the binding
ps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
ps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT)
ps.BindType(3, SQLitePreparedStatement.SQLITE_INTEGER)
ps.BindType(4, SQLitePreparedStatement.SQLITE_INTEGER)

//add the data type to the binding
ps.Bind (0,“Str_1”)
ps.Bind (1,“Str_2”)
ps.Bind (2, 1)
ps.Bind (3, 2)

//make it happen

It adds the record, but you need to Commit to save it.

Hi Tim

Do you mean


Or db.Commit

So that’s what I’m missing.

Thank’s for your help guys.