Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

pass datatable to stored procedure c# dapper

using (SqlConnection con1 = new SqlConnection(connectionstring))
 {
  using (SqlCommand cmd1 = new SqlCommand("your_procedure_name"))
    {
        cmd1.CommandType = CommandType.StoredProcedure;
        cmd1.Connection = con1;                                               

    SqlParameter Param = cmd1.Parameters.AddWithValue("@parameter_name", dt);
    Param.SqlDbType = SqlDbType.Structured;
        con1.Open();
        cmd1.ExecuteNonQuery();
        con1.Close();
    }
}
Source by dapper-tutorial.net #
 
PREVIOUS NEXT
Tagged: #pass #datatable #stored #procedure #dapper
ADD COMMENT
Topic
Name
3+6 =