I am creating a update member page. I would like the page to auto retrieve the information he or she originally used while registering on my site and display them into the individual textboxes of the update profile page, this is to prevent the hassle to rekey in every individual details and allow the user to edit what he or she wants before it is updated into the database.
I am having problem retrieving information from the database and displaying them into the individual asp.net web text boxes. I am trying to use SQL DataAdapter or SQL Reader, but both fails. Some help to resolve this problem please, an example with code snippets will be very much appreciated. :rolleyes:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
displayrecord()
End If
Private Sub displayrecord()
SqlConnection1.Open()
Dim SqlDataAdapter1 As New SqlDataAdapter("SELECT * FROM Member", SqlConnection1)
Dim objReader As SqlDataReader
Dim SqlCommand1 As New SqlCommand("SELECT * FROM Member", SqlConnection1)
SqlDataAdapter1.Fill(dsMember)
objReader = SqlCommand1.ExecuteReader()
objReader.Read()
txtbox_user.Text = objReader("MemberUserName")
txtbox_password.Text = objReader("MemberPassword")
txtbox_confirmpass.Text = objReader("MemberPassword")
txtbox_name.Text = objReader("MemberName")
txtbox_birthdate.Text = objReader("MemberDOB")
txtbox_nric.Text = objReader("NRIC")
txtbox_address.Text = objReader("MemberAddress")
txtbox_contact.Text = objReader("MemberPhone")
txtbox_email.Text = objReader("MemberEmail")
Dropdown_Gender.SelectedValue = objReader("Gender")
DropDown_Age.SelectedValue = objReader("Age")
DropDown_Income.SelectedValue = objReader("Income")
DropDown_Children.SelectedValue = objReader("NumofChildren")
DropDown_HearUs.SelectedValue = objReader("HowDidYouKnowAboutUs")
objReader.Close()
SqlConnection1.Close()
End Sub