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