|
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 = "早上好,登录ID为(" & student_id & ")"
ElseIf DateTime.Now.Hour >= 12 And DateTime.Now.Hour < 18 Then
spWelMessage.Text = "下午好,登录ID为(" & student_id & ")"
Else
spWelMessage.Text = "晚上好,登录ID为(" & 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
最后是修改数据库中users表里面的数据,我运行的时候没有出现错误,但数据库里面的信息却没有改变,是那里有错了啊??? |
|