如何映射两个数据表 [英] how to map two data table
本文介绍了如何映射两个数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已成功创建动态菜单。现在我想通过userrights显示/隐藏菜单
表1 NewMenu(MenuId,MenuName,ParentId,IsActive,Content )
表2 UserRights(UserRightsId,UserId,Content,Add,Edit,Delete,View)
I have created dynamic menu successfully. now I want to show/hide menu via userrights
Table 1 NewMenu (MenuId, MenuName, ParentId, IsActive, Content)
Table 2 UserRights (UserRightsId, UserId, Content, Add, Edit, Delete, View)
推荐答案
这很简单!
1-在NewMenu表中创建MenuId列主键
2- UserRightsId列应该是MenuId列的外键,也就是说,此列应该包含现有的MenuID。
3-编写SQL查询以选择NewMenu表将其加入UserRights表UserRights.UserID =CurrentUserid
希望有帮助
That is simple!
1- Make MenuId column primary key in your NewMenu Table
2- UserRightsId column should be foreign key to MenuId column, that is, This column should contain existing MenuIDs.
3- Write SQL Query to Select NewMenu table Join it to UserRights Table where UserRights.UserID = "CurrentUserid"
Hope that helps
这篇关于如何映射两个数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文