/// <summary> /// 得到一个对象实体 /// </summary> public Tunnel.Model.Vote_Config GetModel(int c_id) { SqlParameter[] parameters = { new SqlParameter("@c_id", SqlDbType.Int, 4) }; parameters[0].Value = c_id; Tunnel.Model.Vote_Config model = new Tunnel.Model.Vote_Config(); DataSet ds = DbHelperSQL.RunProcedure("UP_Vote_Config_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["c_id"].ToString() != "") { model.c_id = int.Parse(ds.Tables[0].Rows[0]["c_id"].ToString()); } model.c_name = ds.Tables[0].Rows[0]["c_name"].ToString(); if (ds.Tables[0].Rows[0]["c_type"].ToString() != "") { model.c_type = int.Parse(ds.Tables[0].Rows[0]["c_type"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tunnel.Model.Vote_Config model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@c_id", SqlDbType.Int, 4), new SqlParameter("@c_name", SqlDbType.NVarChar, 50), new SqlParameter("@c_type", SqlDbType.Int, 4) }; parameters[0].Value = model.c_id; parameters[1].Value = model.c_name; parameters[2].Value = model.c_type; DbHelperSQL.RunProcedure("UP_Vote_Config_Update", parameters, out rowsAffected); }