/// <summary> /// 得到一个对象实体 /// </summary> public SmartLaw.Model.CategoryRegionalRelation DataRowToModel(DataRow row) { SmartLaw.Model.CategoryRegionalRelation model=new SmartLaw.Model.CategoryRegionalRelation(); if (row != null) { if(row["AutoID"]!=null && row["AutoID"].ToString()!="") { model.AutoID=long.Parse(row["AutoID"].ToString()); } if(row["CategotyID"]!=null && row["CategotyID"].ToString()!="") { model.CategotyID=long.Parse(row["CategotyID"].ToString()); } if(row["RegionalID"]!=null) { model.RegionalID=row["RegionalID"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public SmartLaw.Model.CategoryRegionalRelation GetModel(long AutoID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select AutoID,CategotyID,RegionalID from CategoryRegionalRelation"); strSql.Append(" where AutoID=@AutoID limit 1"); MySqlParameter[] parameters = { new MySqlParameter("@AutoID", MySqlDbType.Int64) }; parameters[0].Value = AutoID; SmartLaw.Model.CategoryRegionalRelation model=new SmartLaw.Model.CategoryRegionalRelation(); DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }