public int GetInterId(string branchCode, int billType) { string sql = $"SELECT #ISNULL#(MAX(FMAXID),0) FROM {BillTableName} where FBranchCode=#BranchCode# and FBillType=#BillType#"; RequestBase pars = new RequestBase(); pars.Add("BranchCode", branchCode); pars.Add("BillType", billType); object ret = _Conn.ExecuteScalar(sql, pars); if (SmartCrudHelper.IsNullOrDBNull(ret)) { return(0); } else { return(Convert.ToInt32(ret)); } }
public object SingleValue() { return(_connInfo.ExecuteScalar(GetSql(), param)); }
/// <summary> /// 返回的字段不能为NULL,最好就是 'Y' /// </summary> /// <param name="connInfo"></param> /// <param name="sql"></param> /// <param name="param"></param> /// <returns></returns> public static bool ExistsPrimitive(this DbContext connInfo, string sql, object param = null) { object result = connInfo.ExecuteScalar(sql, param); return(!SmartCrudHelper.IsNullOrDBNull(result)); }