Given below is an example of calling Stored Procedure with Table type Parameter -
public static void saveProductPricing(DataTable ProductPricing)
{
try
{
using (SqlConnection sqlConn = new SqlConnection(Common.ConnectionString))
{
sqlConn.Open();
SqlCommand cmdExecute = new SqlCommand();
cmdExecute.CommandText = "spSaveProductPricing";
cmdExecute.CommandType = CommandType.StoredProcedure;
cmdExecute.CommandTimeout = 0;
cmdExecute.Connection = sqlConn;
cmdExecute.Parameters.AddWithValue("@ProductPricing", ProductPricing);
cmdExecute.Parameters["@ProductPricing"].SqlDbType = SqlDbType.Structured;
cmdExecute.ExecuteNonQuery();
}
}
catch (Exception ex)
{
throw ex;
}
}