Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strsql As String = "update member set Name='" & TextBox1.Text & "' , Address='" & TextBox2.Text & "' , Tel='" & TextBox4.Text & "' where Users='" & Session("user") & "'"
Dim objcmd As New SqlCommand(strsql, con)
con.Open()
objcmd.ExecuteNonQuery()
con.Close()
MsgBox("บันทึกเรียบร้อย", MsgBoxStyle.Information)
Response.Redirect("home.aspx")
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("user") = "" Then
Response.Redirect("login.aspx")
End If
display()
End Sub
Sub display()
Dim sqlcmd As New SqlCommand("select * from member where Users='" & Session("user") & "'", con)
Dim sqlreader As SqlDataReader
con.Open()
sqlreader = sqlcmd.ExecuteReader
While sqlreader.Read
TextBox1.Text = sqlreader.GetString(2)
TextBox2.Text = sqlreader.GetString(3)
TextBox4.Text = sqlreader.GetString(4)
End While
con.Close()
End Sub