想要使用面板中的SP从sql数据库中检索radiobutton检查值 [英] want to retrieve radiobutton checked values from sql database using SP in panel
本文介绍了想要使用面板中的SP从sql数据库中检索radiobutton检查值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SqlConnection con = new SqlConnection("server=localhost;database=bankadmin;Integrated Security=SSPI");
protected void Page_Load(object sender, EventArgs e)
{
Panel1.Visible = true;
}
protected void Button1_Click(object sender, EventArgs e)
{
Panel1.Visible = true;
SqlCommand cmd = new SqlCommand("select * from bankadmin where Accountno=@Accountno");
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "spbankregsearch";
SqlParameter p1 = new SqlParameter("@Gender", SqlDbType.VarChar);
p1.Direction = ParameterDirection.Output;
cmd.Parameters.Add(p1);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
RadioButtonList1.SelectedValue = p1.ToString();
}
推荐答案
首先考虑更改有关如何从数据库中获取数据的代码。请参阅 http://support.microsoft.com/kb/307860 [ ^ ]
然后在设置RadioButton Selected值之前它应该是数据绑定,否则它不会工作
像 http ://forums.asp.net/t/1589093.aspx [ ^ ]
希望这有帮助
First Consider changing your code on how you are fetching the Data from DB . Refer http://support.microsoft.com/kb/307860[^]
Then before you set the RadioButton Selected value it should be Databound or else it wont work
Something like http://forums.asp.net/t/1589093.aspx[^]
Hope this helps
这篇关于想要使用面板中的SP从sql数据库中检索radiobutton检查值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文