Jump to content

tanahara

Members
  • Posts

    5
  • Joined

  • Last visited

Community Answers

  1. tanahara's post in Insert Variables into Table SQLite was marked as the answer   
    This is because you are executing 3 seperate inserts do this
      If Not _SQLite_Exec(-1, "INSERT INTO persons (Name,Location,Computername) VALUES (" & _SQLite_FastEscape($Name) & "," & _SQLite_FastEscape($Location)& "," & _SQLite_FastEscape($CompName)& ")") = $SQLITE_OK Then _ MsgBox(16, "SQLite Error", _SQLite_ErrMsg())  Think of a SQL insert as a row of data, that one row of data includes all those columns.
     
    So since you had 3 you made multiple rows leaving out information on each.
    $InsertSQL = "INSERT INTO persons (Name,Location,Computername) VALUES (" & _SQLite_FastEscape($Name) &","&_SQLite_FastEscape($Location) &","& _SQLite_FastEscape($CompName) &")" If Not _SQLite_Exec(-1, $InsertSQL) = $SQLITE_OK Then _ MsgBox(16, "SQLite Error", _SQLite_ErrMsg()) This is how I recommend doing your insert, created a string allows you to msgbox that string so you can see exactly what your insert string looks like. It also makes your sqlite execution code easier to read. This is just personal pref.
×
×
  • Create New...