Click here to Skip to main content
15,904,288 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have code behind for a pop windows which displays from table w1....I was trying to find a way where it can display all the rows from tabl w1 cause right now it only displays 1 row..anyone know how to do that? thanks

C#
public partial class Default2 : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection("Data Source=xxx.xx.xxx.xxx;Initial Catalog=x;Uid=t;Password=xxx;");
    SqlCommand cmd;
    SqlDataReader dr;
    TextBox email = new TextBox();
    protected void Page_Load(object sender, EventArgs e)
    {
        email.Text = "" + Session["email"];
    }
    protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {
        con.Open();
        cmd = new SqlCommand("SELECT C, P, t,  FROM w1 WHERE email='" + email.Text + "'", con);
        dr = cmd.ExecuteReader();
        con.Close();
    }
}
Posted
Updated 9-Nov-11 17:14pm
v2

1 solution

The code in SqlDataSource1_Selecting serves nothing. If you are populating table w1 from datasource then you need to change the SelectCommand[^] in datasource.
 
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