SQLite question

I have a database containing 2 tables: Adapter and Keywords.

When the configuration of the application is saved I want to delete the contents of both tables and insert all new values into the tables.

However, something goes wrong, I have in table-1 the field ConfData and in table-2 the field Keyword. When I insert the new values into table-1 field Confdata then everything works as designed. When I want to insert in table-2 I get an error that the field ConfData does not exist, while I put in the statement that the value is for field Keyword and the value is written in table-2; Keywords. I can not figure out why . The books I have about SQLite only describes how to work with single table databases.

The code I wrote:
if db.Connect = true Then
db.SQLExecute(“DELETE from Adapter”)
For I = 1 to Ubound(Config)
row.Column(“ConfData”) = Config(I)
db.InsertRecord(“Adapter”,row)
next
db.Commit

db.SQLExecute ("DELETE from keywords")
for I = 0 to KWList.ListCount -1
  row.Column("Keyword") = KWList.List (I)
  db.InsertRecord("KeyWords",row)                                          [b]   <<<<----- at this point I do get the error that Field ConfData does not exist [/b]
next
   db.Commit

end if
db.close

The database looks like:
Table Adapter
…Field: ConfData

Table Keywords
…Field: Keyword

Can someone known with SQLite explain this behavior?

You need to reinitialize the row property. It still contains the value from the first loop.

Something like

row = new databaserecord 

At the beginning of the second loop.

Thanks Greg, that was indeed the missing line…everything works ok now :slight_smile: