title: How to use datatable as a SQL Server temp table?
body: <p>I have a SQL Update query and a DataTable of C#. I wanted to use this DataTable as TempTable of SQL Server. The query will execute at C# side (by ADO.NET)</p>
  
  <p>Please check the C# code below-</p>
  
  <p>1) C# DataTable:</p>
  
  <pre><code>DataTable dt  = new DataTable();
  </code></pre>
  
  <p>2) Update query:</p>
  
  <pre><code>using (var cmd = cn.CreateCommand())
  {
  
    cmd.CommandText = "UPDATE p
                       SET p.Name = t.Name, p.Type = t.Type
                       FROM Product AS p
                       INNER JOIN dt AS t ON p.id = t.id"
  
  
  cmd.ExecuteNonQuery();
  
  }
  </code></pre>
  
  <p>I can't use a SQL Stored procedure in my case.</p>