using (SqlConnection conn = new SqlConnection(this.GetConnectionString(this.WMPDBName)))
{
SqlCommand cmd = conn.CreateCommand();

cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "存储过程名称";

////输出参数
cmd.Parameters.Add(new SqlParameter("@DeleteTotal", System.Data.SqlDbType.Int));
cmd.Parameters["@DeleteTotal"].Direction = System.Data.ParameterDirection.Output;
cmd.Parameters.Add(new SqlParameter("@InsertTotal", System.Data.SqlDbType.Int));
cmd.Parameters["@InsertTotal"].Direction = System.Data.ParameterDirection.Output;

//// 输入参数【方式一】
cmd.Parameters.Add(new SqlParameter("@PageIndex", System.Data.SqlDbType.Int));
cmd.Parameters["@PageIndex"].Direction = System.Data.ParameterDirection.Input;
cmd.Parameters["@PageIndex"].Value = 1;

//// 输入参数【方式二】
cmd.Parameters.Add(new SqlParameter("@PageIndex", 1));
conn.Open();
cmd.ExecuteNonQuery();
int.TryParse(cmd.Parameters["@DeleteTotal"].Value.ToString(), out deleteTotal);
int.TryParse(cmd.Parameters["@InsertTotal"].Value.ToString(), out insertTotal);
}

相关文章:

  • 2022-03-05
  • 2022-12-23
  • 2021-09-17
  • 2021-05-19
  • 2021-05-19
  • 2021-06-04
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
相关资源
相似解决方案