Hi
In my home page I have the login form & the link button named "Update Profile?". If I click that link button, then it redirects to the page which has the Profile Updation Process which includes all the profile details that the user registered during registration and the user can update the existing profile here. For that, in the profile updation page, I have given the coding as
Imports System.Data
Imports System.Data.SqlClient
Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim str, str1 As String
str = "user id=sa;password=cast;database=jsc;server=AURORA-SERVER"
con = New SqlConnection(str)
Try
con.Open()
Catch
End Try
str1 = "select * from login"
cmd = New SqlCommand(str1, con)
Dim dr1 As SqlDataReader
dr1 = cmd.ExecuteReader()
While dr1.Read()
txtLoginId2.Text = dr1.GetValue(0)
txtPassword1.Text = dr1.GetValue(1)
txtConfirmPassword.Text = dr1.GetValue(2)
txtFirstName.Text = dr1.GetValue(3)
txtLastName.Text = dr1.GetValue(4)
txtAddress.Text = dr1.GetValue(5)
txtAddress2.Text = dr1.GetValue(6)
txtAddress3.Text = dr1.GetValue(7)
txtCity.Text = dr1.GetValue(8)
txtCountry.Text = dr1.GetValue(9)
txtProvince.Text = dr1.GetValue(10)
txtPostalCode.Text = dr1.GetValue(11)
txtPhone.Text = dr1.GetValue(12)
txtEmail1.Text = dr1.GetValue(13)
txtHow.Text = dr1.GetValue(14)
End While
con.Close()
End If
End Sub
Protected Sub btnUpdateProfile_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRegister.Click
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim str, str1 As String
str = "user id=sa;password=cast;database=jsc;server=AURORA-SERVER"
con = New SqlConnection(str)
Try
con.Open()
Catch
End Try
str1 = "update login set loginid='" & txtLoginId2.Text & "', password='" & txtPassword1.Text & "',confirmpassword='" & txtConfirmPassword.Text & "',firstname='" & txtFirstName.Text & "',lastname='" & txtLastName.Text & "',address='" & txtAddress.Text & "',address2='" & txtAddress2.Text & "',address3='" & txtAddress3.Text & "',city='" & txtCity.Text & "',country='" & txtCountry.Text & "',province='" & txtProvince.Text & "',postalcode=" & txtPostalCode.Text & ",phone='" & txtPhone.Text & "',email='" & txtEmail1.Text & "',how='" & txtHow.Text & "'"
cmd = New SqlCommand(str1, con)
cmd.ExecuteNonQuery()
con.Close()
Response.Redirect("Default3.aspx")
End Sub
End Class
But if I give the above coding, only the last record is getting displayed on the textbox. The thing is the profile should get displayed on the textboxes according to the loginid and password that the user has entered on the login page.