Answer to Question #31931 in C# for Tima

Question #31931
public partial class Edit : System.Web.UI.Page
{
SqlConnection sqlcon = new SqlConnection(@"Server=USER-PC;database=Asset_Store;uid=sa;pwd=sa;");
SqlCommand sqlcmd;
SqlDataAdapter da;
DataTable dt = new DataTable();

protected void Page_Load(object sender, EventArgs e)
{

if (!Page.IsPostBack)
{


sqlcon.Open();
sqlcmd = new SqlCommand("select * from category" , sqlcon);

da = new SqlDataAdapter(sqlcmd);
da.Fill(dt);

if (dt.Rows.Count > 0)
{

TextBox4.Text = dt.Rows[0][7].ToString();
TextBox2.Text = dt.Rows[0][8].ToString();
TextBox3.Text = dt.Rows[0][9].ToString();


}
sqlcon.Close();
}

}
this program is only reading the first row
when i press edit in any other row the data of the first row appear
wat to do?
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS