在应用程序中隐藏记录(ASP.NET)

编程入门 行业动态 更新时间:2024-10-15 22:22:22
本文介绍了在应用程序中隐藏记录(ASP.NET)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两个表..父表...(主键)类别(CategoryId,CategoryName)和子表..(外键)Item(ItemId,ItemName,ItemCode,CategoryId)..它们之间有关系.. 当我通过点击按钮删除应用程序中的记录...而不是记录...不应该被删除...但应该从应用程序中隐藏...并且应该存在于数据库中table ...如果我从文本框中搜索记录...使用文本更改事件,它不应该被用户看到...以及当用户尝试在同一个隐藏记录上添加数据时ItemId ...应该有一条消息..你不能插入重复的记录....等待...你的回复...提前谢谢....我已经搜索了很多但是...没有来......手... 。 我尝试了什么: i使用dml操作。 ..但是我第一次遇到这种情况

i have two tables.. A parent table...(Primary key) Category(CategoryId,CategoryName) and child table ..(Foreign key) Item(ItemId,ItemName,ItemCode,CategoryId)..having relationship between them.. when i delete records from application through a button click ...than record...should not be deleted...but should be hidden from application...and should be present in database table...and if i search the record from a textbox ...with the text changed event it should not be seen to the user...and also when a user tries to add data on the same hidden record ItemId...there should be a message ..that you cannot insert duplicate records....waiting for..your reply... thanks in advance....i have searched a lot but...nothing comes..handy.... What I have tried: i worked with dml operation ...but this kind of situation iam facing for first time

推荐答案

1。我希望删除记录的数据库表列标志,设置此位类型,例如删除此字段的记录值= 1. 2.您的数据库查询应排除deleted = 1的位置,因此只返回可见未删除的数据。 /> 例如MS SQL: 从table1中选择*哪里没有(删除= 1) 3.在插入时,首先进行查询以检查是否记录存在使用记录参数,包括删除= 1 例如在MS SQL中: 1. I would expect a data base table column flag for the deleted record, set this bit type e.g. deleted record value for this field = 1. 2. Your database query should exclude where deleted = 1 and thus only return "visible" non-deleted data. e.g. MS SQL: select * from table1 where not (deleted = 1) 3. On insert, first do query to check if the record exists using record parameters including deleted = 1 e.g. in MS SQL: if not exists (select * from table1 where col1 = @col1 and col2 = @col2 etc...) begin insert into table 1 @col1, @col2 etc... end else begin update table1 set deleted = 0 where col1 = @col1 and col2 = @col2 etc... end

更多推荐

在应用程序中隐藏记录(ASP.NET)

本文发布于:2023-11-15 15:59:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1595881.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   ASP   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!