/// <summary>
/// 存储过程的调用,sql为存储过程的名字,parms[]为可传入的存储过程参数数组,若无,为空
/// </summary>
/// <param name="sql"></param>
/// <param name="parms"></param>
/// <returns></returns>
public static SqlDataReader Exec(string sql, SqlParameter[] parms)
{
SqlConnection connection = new SqlConnection();
connection.ConnectionString = connectionString;
connection.Open();
SqlCommand cmd = connection.CreateCommand();
= CommandType.StoredProcedure;
= sql;
if (parms != null)
{
cmd.Parameters.AddRange(parms);
}
return cmd.ExecuteReader(CommandBehavior.CloseConnection);
}
}