title: Inserting multiple values into a SQL database from EXCEL through VBA script
body: <p>Just trying to insert data from 5 cells via a VBA script, into a column on an SQL server 08 database.</p>
  
  <p>So basically I have 1 table with 4 columns, I want to insert multiple sets of data into the columns at once which would insert data into the DB with the below result..</p>
  
  <pre><code>Server Name     Middleware  Version License 
  TEST6           Testing     1       1
  TEST6           Testing1    1       1
  TEST6           Testing2    1       1
  TEST6           Testing3    1       1
  </code></pre>
  
  <p>I know the values are not correct on the below code, but I get the error message (below the vba code) when the VBA script is executed.</p>
  
  <pre><code>Dim val1 As String, val2 As String, val3 As String, val4 As String
  
  val1 = Range("B126").Value
  val2 = Range("C126").Value
  val3 = Range("C127").Value
  val4 = Range("D126").Value
  
  conn.Open sConnString
  
  Dim item As String
  item4 = "INSERT INTO [IndustrialComp].[dbo].[Middleware]("
  item4 = item4 &amp; "  [server_name],[middleware],[middlware],[version]"
  
  item4 = item4 &amp; "  )Values("
  item4 = item4 &amp; "  '" &amp; val1 &amp; "', '" &amp; val2 &amp; "', '" &amp; val3 &amp; "','" &amp; val4 &amp; "')"
  
  conn.Execute item4
  
  End Sub
  </code></pre>
  
  <p>Msg 264, Level 16, State 1, Line 1
  The column name 'middleware' is specified more than once in the SET clause. A column cannot be assigned more than one value in the same SET clause. Modify the SET clause to make sure that a column is updated only once. If the SET clause updates columns of a view, then the column name 'middleware' may appear twice in the view definition.</p>