title: C# Insert into SQL Table with List as parameter
body: <p>With sincere help from experts in this wonderful forum, I have been able to parsed my xml returned by a SharePoint list to get the desired  list items into C# Lists.</p>
  
  <pre><code>XDocument xdoc = XDocument.Parse(activeItemData.InnerXml);
  XNamespace z = "#RowsetSchema";
  
  List&lt;int&gt; listID = (from row in xdoc.Descendants(z + "row") 
  select (int)row.Attribute("ows_ID")).ToList();
  
  List&lt;string&gt; listTitle = (from row in xdoc.Descendants(z + "row") 
  select (string)row.Attribute("ows_LinkTitle")).ToList();
  </code></pre>
  
  <p>I have created a SQL table and I want to insert values in my table using Lists listID and listTitle as parameters</p>
  
  <pre><code>System.Data.SqlClient.SqlConnection sqlConnection1 =
              new System.Data.SqlClient.SqlConnection(MyconnectionString);
  
              System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
              cmd.CommandType = System.Data.CommandType.Text;
              cmd.CommandText = "INSERT TechOpsProjectTracker (ID, [Project Name]) VALUES (@ID, @ProjectName)";
  
  //What I want to do:
              //1. @ID should get the values from the List listID: List&lt;int&gt; listID = (from row in xdoc.Descendants(z + "row") select (int)row.Attribute("ows_ID")).ToList();
              //2. @ProjectName should get the values from the List listTitle: List&lt;string&gt; listTitle = (from row in xdoc.Descendants(z + "row") select (string)row.Attribute("ows_LinkTitle")).ToList();
              //3. so each new record inserted in the table has ID and its corresponding Project Name. Something like this
              /* ID    Project Name
                 360   GEI Survey data to Sharepoint
                 378   Create back end and environment to support User demographic reporting
  
  
               */
  </code></pre>
  
  <p>There might be some other possibly easier ways to accomplish my job. Please let me know. TIA.</p>