Click here to Skip to main content
15,921,226 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
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();
}
Posted
v2
Comments
Harshil_Raval 30-Oct-13 1:58am    
Is it gives any error or what?
also,
SqlCommand cmd = new SqlCommand("select * from bankadmin where Accountno=@Accountno");
you have specify select query in sqlcommand, and after that you are giving sql type as stored procedure and passing sp name!!!! also, you have not specify connection to sqlcommand...
JoCodes 30-Oct-13 3:04am    
Clean up your SQL data retrieving part first as already pointed out by Harshil to fetch some data

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900