Passing datatable to a stored procedure

后端 未结 3 617
长发绾君心
长发绾君心 2020-12-01 09:55

I have a datatable created in C#.

using (DataTable dt = new DataTable())
{
    dt.Columns.Add(\"MetricId\", typeof(int));
    dt.Columns.Add(\"Descr\", typeo         


        
3条回答
  •  死守一世寂寞
    2020-12-01 10:32

    You can use a Table Valued Parameter as of SQL Server 2008 / .NET 3.5....

    Check out the guide on MSDN

    Also, as there other options available, I have a comparisonof 3 approaches of passing multiple values (single field) to a sproc (TVP vs XML vs CSV)

提交回复
热议问题