public C_ERROR_CODE GetByid(string id, OleExec DB) { string strSql = $@"select * from c_error_code where id=:id"; OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":id", id) }; DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, paramet); if (res.Rows.Count > 0) { Row_C_ERROR_CODE ret = (Row_C_ERROR_CODE)NewRow(); ret.loadData(res.Rows[0]); return(ret.GetDataObject()); } else { return(null); } }
public C_ERROR_CODE GetByErrorCode(string ErrorCode, OleExec DB) { //string strSql = $@"select * from c_error_code where error_code=:ErrorCode"; string strSql = $@"select * from c_error_code where error_code='{ErrorCode}'"; //OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":ErrorCode", ErrorCode) }; //DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, paramet); DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, null); if (res.Rows.Count > 0) { Row_C_ERROR_CODE ret = (Row_C_ERROR_CODE)NewRow(); ret.loadData(res.Rows[0]); return(ret.GetDataObject()); } else { return(null); } }
public List <C_ERROR_CODE> GetByFuzzySearch(string ParametValue, OleExec DB) { string strSql = $@"select * from c_error_code where upper(error_code) like'%{ParametValue}%' or upper(english_description) like'%{ParametValue}%' or upper(chinese_description) like'%{ParametValue}%'"; List <C_ERROR_CODE> result = new List <C_ERROR_CODE>(); DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text); if (res.Rows.Count > 0) { for (int i = 0; i < res.Rows.Count; i++) { Row_C_ERROR_CODE ret = (Row_C_ERROR_CODE)NewRow(); ret.loadData(res.Rows[i]); result.Add(ret.GetDataObject()); } return(result); } else { return(null); } }
public List <C_ERROR_CODE> GetAllErrorCode(OleExec DB) { string strSql = $@"select * from c_error_code "; List <C_ERROR_CODE> result = new List <C_ERROR_CODE>(); DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text); if (res.Rows.Count > 0) { for (int i = 0; i < res.Rows.Count; i++) { Row_C_ERROR_CODE ret = (Row_C_ERROR_CODE)NewRow(); ret.loadData(res.Rows[i]); result.Add(ret.GetDataObject()); } return(result); } else { return(null); } }