title: Convert sqlite int table to string and then input list
body: <p>I want to transfer items from my LIST in c# to a TABLE in SQLite. I had no clue how to do this until someone suggested that I use parameters: </p>
  
  <p>This was my initial attempt: (Of course it is wrong) </p>
  
  <pre><code>    SQLiteConnection sqlite_conn;
      SQLiteCommand sqlite_cmd;
  
      sqlite_conn = new SQLiteConnection("Data Source=database.db;Version=3;New=True;Compress=True;");
  
      sqlite_conn.Open();
  
      sqlite_cmd = sqlite_conn.CreateCommand();
  
      sqlite_cmd.CommandText = "CREATE TABLE table1 (Seq integer primary key, Field integer , Description integer );";
  
      sqlite_cmd.ExecuteNonQuery();
  
      for (int i = 0; i &lt; 500; i+=3)
      {
          // Lets insert something into our new table:
          sqlite_cmd.CommandText = "INSERT INTO table1 (Seq, Field, Description) VALUES (list[i], list[i+1], list[i+2]);"; THIS IS WHERE PROBLEM OCCURS!
  
          sqlite_cmd.ExecuteNonQuery(); 
      }
  
      sqlite_conn.Close();
  }
  </code></pre>
  
  <p>This is what a user suggested I should do ( add parameters and stuff) :</p>
  
  <pre><code> sqlite_cmd.CommandText = "INSERT INTO table1 (Seq, Field, Description) VALUES (@p1,       @p2, @p3)";
    sqlite_cmd.Parameters.AddWithValue("@p1", 0);  // dummy initial values 
    sqlite_cmd.Parameters.AddWithValue("@p2", 0);
    sqlite_cmd.Parameters.AddWithValue("@p3", 0);
    for (int i = 0; i &lt; 500; i+=3)
  {
     sqlite_cmd.Parameters["@p1"].Value = Convert.ToInt32(list[i]);
    ** sqlite_cmd.Parameters["@p2"].Value = Convert.ToInt32(list[i+1]); ERROR OCCURS HERE
     sqlite_cmd.Parameters["@p3"].Value = Convert.ToInt32(list[i+2]); 
     sqlite_cmd.ExecuteNonQuery(); 
   }
  </code></pre>
  
  <p><em><strong>The Problem :</em></strong></p>
  
  <p>Inside the for loop, as indicated by the 2 stars, I am getting an error saying: <strong><em>"Input string was not in a correct format."</em></strong> </p>
  
  <p>I tried to look at the solutions to previous posts which had the same error as this but not much luck so far.</p>
  
  <p>I think my error is that the list initially has string values but later I try inputting into it integer sqlite columns (see create table statement in original code) </p>
  
  <p>Since the original list values are all strings, how would I simply make a table insqlite which stores STRING values from my list and avoid the error?</p>
  
  <p>Can someone pls help me with the exact syntax?  </p>