/// <summary> /// 删除一条数据 /// </summary> public int Delete(int group_id) { using (DBServer db = new DBServer()) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete [elink_group] "); strSql.Append(" where group_id=@group_id"); SqlParameter[] parameters = { db.MakeInParam("@group_id", SqlDbType.Int, 4, group_id) }; return(db.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters)); } }
/// <summary> /// 增加一条数据 /// </summary> public int InsertData(GroupInfo model) { using (DBServer db = new DBServer()) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [elink_group] ("); strSql.Append("group_name,group_subjectionId,group_subjectionName,group_subjectionIds,group_display)"); strSql.Append(" values ("); strSql.Append("@group_name,@group_subjectionId,@group_subjectionName,@group_subjectionIds,@group_display)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { db.MakeInParam("@group_name", SqlDbType.VarChar, 200, model.Group_name), db.MakeInParam("@group_subjectionId", SqlDbType.Int, 4, model.Group_subjectionId), db.MakeInParam("@group_subjectionName", SqlDbType.VarChar, 200, model.Group_subjectionName), db.MakeInParam("@group_subjectionIds", SqlDbType.VarChar, 5000, model.Group_subjectionIds), db.MakeInParam("@group_display", SqlDbType.TinyInt, 1, model.Group_display), }; return(db.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters)); } }
/// <summary> /// 更新一条数据 /// </summary> public int UpDate(GroupInfo model) { using (DBServer db = new DBServer()) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [elink_group] set "); strSql.Append("group_name=@group_name,"); strSql.Append("group_subjectionId=@group_subjectionId,"); strSql.Append("group_subjectionName=@group_subjectionName,"); strSql.Append("group_subjectionIds=@group_subjectionIds,"); strSql.Append("group_display=@group_display"); strSql.Append(" where group_id=@group_id "); SqlParameter[] parameters = { db.MakeInParam("@group_id", SqlDbType.Int, 4, model.Group_id), db.MakeInParam("@group_name", SqlDbType.VarChar, 200, model.Group_name), db.MakeInParam("@group_subjectionId", SqlDbType.Int, 4, model.Group_subjectionId), db.MakeInParam("@group_subjectionName", SqlDbType.VarChar, 200, model.Group_subjectionName), db.MakeInParam("@group_subjectionIds", SqlDbType.VarChar, 5000, model.Group_subjectionIds), db.MakeInParam("@group_display", SqlDbType.TinyInt, 1, model.Group_display) }; return(db.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters)); } }