Click here to Skip to main content
15,118,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can anyone help me out for retrieving data,i have this code but it aint working as expected
HTML
protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        DataTable dt = new DataTable();
        con1.Open();
        SqlDataReader myReader = null;
        SqlCommand myCommand = new SqlCommand("select * from s3 where username='" + Session["username"] + "'", con1);

    while (myReader.Read())
        {
           
            TextBox1.Text=(myReader["username"].ToString());
            TextBox2.Text=(myReader["password"].ToString());
            TextBox3.Text=(myReader["email"].ToString());
        }
        con1.Close();
    }
Posted
Comments
[no name] 30-Mar-14 11:29am
   
How would you suppose that we would know what "it aint working as expected" means? Why are you not executing your command?
haunter_007 31-Mar-14 4:58am
   
opps :D :D thanx anyways :P

1 solution

   

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