Dear Sir,
I am making a profile page in Asp.net using C# where i am confused how to fetch data from my database which i created to store the detail of a student.i have taken different labels in which i want to show each respective fields of database in the respective labels(like first name,last name).
Rahul PrajapatPosted Jul 9, 2015, 10:24 PM
DataTable dt1;
SqlDataAdapter da;
string str = "select top 1 firstname,lastname,emailid,phoneNumber from Student where
con.Open();
dt = new DataTable();
da = new SqlDataAdapter(str, con);
da.Fill(dt);
{
lblFname.Text = dt.Rows[0][0].ToString();
lblLname.Text = dt.Rows[0][1].ToString();
lblEmail.Text = dt.Rows[0][2].ToString();
lblPhone.Text = dt.Rows[0][3].ToString();
}
con.Close()
keerthi saiPosted Jul 9, 2015, 7:50 PM