Click here to Skip to main content
15,912,932 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wants that when i click on accesories button then all the related records of that accesories

should come.. related to accesories there are four records.. i have taken four link button i wants that four records in that four link button..
my coding is this but in this only Ist record is coming in four of the link button..
protected void btnacces_Click(object sender, EventArgs e)
    {
        //take oledb command
        OleDbCommand cmd = conn.CreateCommand();
        cmd.CommandText = "select * from subcategory where cateid=2";
        //take oledb datareadreader
        OleDbDataReader dr;
        dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            LinkButton1.Visible = true;
            LinkButton2.Visible = true;
            LinkButton3.Visible = true;
            LinkButton4.Visible = true;
            LinkButton1.Text = dr.GetString(2);
            LinkButton2.Text = dr.GetString(2);
            LinkButton3.Text = dr.GetString(2);
            LinkButton4.Text = dr.GetString(2);
        }
  dr.Close();
}


please help me..
Posted
Updated 14-Jun-10 2:20am
v2
Comments
Sandeep Mewara 14-Jun-10 8:20am    
Pre tags are your friends. Use it for code formatting.

1 solution

hi dear,

just use dr.next() insted of dr.read()

thanks

Mahesh Patel
 
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