如何使用vb.net在asp.net中连接单选按钮列表和数据库 [英] How to connect radio buttonlist and Database in asp.net using vb.net

查看:251
本文介绍了如何使用vb.net在asp.net中连接单选按钮列表和数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这有点长,我会尽量缩短我有3个按钮1.打开2.Confidential到部门3.Restricted到选定的用户。我在下面有一个列表框,为受限制的所选用户按钮选择用户。现在我要做的就是当我点击打开并保存数据时,当我点击第二个按钮时,任何用户点击搜索都会显示,部门用户可以在点击搜索时看到数据,点击第三个按钮并选择仅选择一些用户用户可以在点击搜索时查看数据。我想用户应该从数据库中获取任何人都可以帮助我如何做到这一点。下面我分享了一段我已经完成的代码。



This is little bit lengthy I will try to make it short I have 3 buttons 1.Open 2.Confidential to department 3.Restricted to selected users. I have a list box below to select the users for Restricted selected users button. Now what I want to do is if I click open and save the data when any user click search it should display when I click second button only that department users can see the data when click search and when click 3rd button and select some users only selected users can see the data when click search. I guess the users should get from the data base can anyone help me how to do this. Below I shared a piece of code which I have done.

 <asp:radiobuttonlist id="rbSecurityLevel" runat="server">
       <asp:listitem id="option1" runat="server" value="1">Open</asp:listitem>
<asp:listitem id="option2" runat="server" value="2">Confidential to Department</asp:listitem> 
<asp:listitem id="option3" runat="server" value="3">Restricted to Selected Users</asp:listitem> 
                 </asp:radiobuttonlist >

推荐答案

hi,

你想要保存具有不同限制的数据。像机密数据只显示部门成员。我建议你使用列表项值..当你在数据库中保存数据的时候你也在列中保存了radiobutton选择的项目值,之后在搜索选项中你可以在查询中应用条件。喜欢这个





string s =从TableName中选择* ListValue =< 1;



或第二个查询是

string s =从TableName中选择* ListValue = 2;



并且在选定的用户中你可以运行这些查询



string s =Select * From TableName where ListValue = 3;



注意: ListValue是您在数据库中存储RedioButton值的新列


这篇关于如何使用vb.net在asp.net中连接单选按钮列表和数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆