|
Partial Class upuser
Inherits System.Web.UI.Page
Dim sqlcon As New SqlConnection
Dim myCommand As New SqlCommand
Private Sub Page_Load (ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim student_id As String = Request.Cookies ("userInf"). Values ("userID")
Dim con As New SqlConnection ("server = .; database = user; uid = lgw; password = lgw")
Dim cmd As New SqlCommand ("select * from users where id = '"&Request.Cookies ("userInf"). Values ("userID")&"'", con)
Dim dr As SqlDataReader
con.Open ()
dr = cmd.ExecuteReader
dr.Read ()
showid.Text = dr.Item ("id")
showName.Text = dr.Item ("name")
showTel.Text = dr.Item ("tel"). ToString
showEmail.Text = dr.Item ("email"). ToString
showIntro.Text = dr.Item ("intro"). ToString
con.Close ()
If DateTime.Now.Hour> = 6 And DateTime.Now.Hour <12 Then
spWelMessage.Text = "Good morning, login ID is ("&student_id&")"
ElseIf DateTime.Now.Hour> = 12 And DateTime.Now.Hour <18 Then
spWelMessage.Text = "Good afternoon, login ID is ("&student_id&")"
Else
spWelMessage.Text = "Good evening, login ID is ("&student_id&")"
End If
End Sub
Protected Sub reset_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Reset.Click
showPWD.Text = ""
textpwd.Text = ""
showName.Text = ""
showTel.Text = ""
showEmail.Text = ""
showIntro.Text = ""
End Sub
Protected Sub Enter_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Enter.Click
Dim myCommand As New SqlCommand
Dim sqld2 As String
Dim ds As New Data.DataSet
sqlcon = New SqlConnection ("server = .; database = user; uid = lgw; password = lgw")
sqlcon.Open ()
'myCommand.Connection = sqlcon
sqld2 = "update users set intro = '"&showIntro.Text&"' where id = '"&showid.Text&"'"
myCommand = New SqlCommand (sqld2, sqlcon)
myCommand.ExecuteNonQuery ()
sqlcon.Close ()
End Sub
End Class
The last is to modify the data in the users table in the database. When I run, there are no errors, but the information in the database has not changed. Is there something wrong? ? ? |
|