title: Express passing arrays into sql (express/mssql/react)
body: <p>I am trying to upload two arrays into my sql database. 
  This is what I have come up with.(this is my server.js using a endpoint from my client side) </p>
  
  <p>My express </p>
  
  <pre><code>app.post("/post-question-answers", async (req, res) =&gt; {
    console.log("!called");
    try {
      await sql.connect(config);
  
      // create Request object
      var request = new sql.Request();
  
      let results = req.body.results;
  
      let questions = [];
      let answers = [];
  
      results.forEach(element =&gt; questions.push(element.question));
      results.forEach(element =&gt; answers.push(element.answer));
  
      for (var i = -1; i &lt; results.length; i++) {
        request.input("Question", sql.VarChar, questions[i]);
        request.input("Answer", sql.VarChar, answers[i]);
        request.execute("dbo.AddQuestionResponses", function(err, recordset) {
          if (err) console.log(err);
          // send records as a response
          res.json(recordset);
        });
      }
    } catch (e) {
      console.log(e);
    }
  });
  </code></pre>
  
  <p>My sql stored procedrue</p>
  
  <pre><code>alter procedure AddQuestionResponses
  @Question nvarchar (50),
  @Answer nvarchar (50)
  
  
  as 
  
  insert into QuestionResponses(QuestionWhenAnswered, QuestionResponse)
  values (@Question ,@Answer )
  
  
  
  
  </code></pre>
  
  <p>However this throws</p>
  
  <pre><code>RequestError: The parameter name Question has already been declared. Parameter names must be unique
  </code></pre>
  
  <p>I believe this is because </p>
  
  <pre><code>  request.input("Question", sql.VarChar, questions[i]);
        request.input("Answer", sql.VarChar, answers[i]);
  </code></pre>
  
  <p>need to be unique and as they are in a for loop they are repeated within the statement. Is there a way in which I can make this a valid transaction with the database and so that these are unique.</p>
  
  <p>Thankyou for your time :) </p>