如何从数据库中检索数据? [英] how to retrieve data from database?

查看:99
本文介绍了如何从数据库中检索数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个单选按钮控件,我想对每个选定的索引使用不同的选择查询从数据库中检索数据.
例如:如果选择单选按钮列表的索引0,则应调用选择查询,如果选择1,则应调用其他选择查询.
如何编写代码?
我需要一些常规概述和语法..

i have a radiobuttonlist control and i want to retrieve the data from database using different select query for each selected index.
for eg: if index 0 of radiobuttonlist is selected, it should call a select query and if 1, some other select query.
how to write the code?
i want some general overview and syntax..

推荐答案

在RadioButtonList1_SelectedIndexChanged事件中执行此操作
1.设置AutoPost Back属性= true
2.在RadioButtonList1_SelectedIndexChanged事件中执行此操作

Do this in RadioButtonList1_SelectedIndexChanged event
1. Set AutoPost Back property = true
2. In RadioButtonList1_SelectedIndexChanged event do this

if (RadioButtonList1.SelectedValue == "0")
     //select query
else if (RadioButtonList1.SelectedValue == "1")
    //select query
//and so on


这篇关于如何从数据库中检索数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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