我有两个表..父表...(主键)类别(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)
发布评论