4
Answers

How to write two select query in one button click event

anil wagavkar

anil wagavkar

8y
510
1
my code is  i wana write another select statment in this button but i am confuse where....plz help
 
 
 
protected void Button4_Click(object sender, EventArgs e)
{
if (rankuserid.Text.Length == 0)
{
Response.Write("<script>alert('Please type RankUser ID correctly and click Submit button again. Thanks....')</script>");
}
else
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from salesmans_master where rankuser=" + rankuserid.Text);
cmd.Connection = con;
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
rankcode.Text = dr["rankcode"].ToString();
be.Text = dr["rank1"].ToString();
srbe.Text = dr["rank2"].ToString();
fdo.Text = dr["rank3"].ToString();
fi.Text = dr["rank4"].ToString();
srfi.Text = dr["rank5"].ToString();
doff.Text = dr["rank6"].ToString();
zo.Text = dr["rank7"].ToString();
po.Text = dr["rank8"].ToString();
pog.Text = dr["rank9"].ToString();
bd.Text = dr["rank10"].ToString();
con.Close();
}
}
 
Answers (4)