DBHelper.GetExcuteNonQuery(sb.ToString()) > 0;
public static int GetExcuteNonQuery(string cmdTxt)
{
return GetExcuteNonQuery(cmdTxt, null);
}
/// <summary>
/// 带参数化的 主要用于(增加,删除,修改),返回受影响的行数
/// </summary>
/// <param name="cmdTxt">带参数列表的sql语句</param>
/// <param name="pars">要传入的参数列表</param>
/// <returns></returns>
public static int GetExcuteNonQuery(string cmdTxt, params SqlParameter[] pars)
{
using (cmd = new SqlCommand(cmdTxt, Connectionstrings))
{
if (pars != null)
cmd.Parameters.AddRange(pars);
return cmd.ExecuteNonQuery();
}
}