title: Number of query values and destination fields are not the same (Union)
body: <p>Running into this SQL error - number of query values and destination fields are not the same (Union). Using an Access database. The programList table has just two fields in it - userID and programID. Using parameters in my cs file. Here is the complete method:</p>
  
  <pre><code>public void AddProgramList (string program, int userID)
  {
      dbConnection.Open();
  
      string sqlStmt = "INSERT INTO programs (program) ";
      sqlStmt += "VALUES (@program)";
      string sqlStmt2 = "INSERT INTO programList (userID, programID) " +
                        "SELECT userID " +
                        "FROM users" +
                        "WHERE userID = @userID " +
                        "UNION " +
                        "SELECT programID " +
                        "FROM programs" +
                        "WHERE program = @program;";
  
      OleDbCommand dbCommand = new OleDbCommand(sqlStmt, dbConnection);
  
      OleDbParameter param = new OleDbParameter("@program", program);
  
      dbCommand.Parameters.Add(param);
  
      dbCommand.Parameters.Add(new OleDbParameter("@userID", userID));
  
      OleDbCommand dbCommand2 = new OleDbCommand(sqlStmt2, dbConnection);
  
      OleDbParameter param2 = new OleDbParameter("@program", program);
  
      dbCommand2.Parameters.Add(param2);
  
      dbCommand2.Parameters.Add(new OleDbParameter("@userID", userID));
  
  
      dbCommand.ExecuteNonQuery();
  
      dbCommand2.ExecuteNonQuery();
  
      dbConnection.Close();
  }
  </code></pre>