Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
connectingstring = "data source=(local);Database=library;uid=sa;pwd=123456;"
myConn = New SqlConnection(connectingstring)
If Session("UserID") = "" Then
Response.Redirect("Login.aspx")
Else
LoadUserInfo(Session("UserID"))
End If
End Sub
Public Function ExecReaderSql(ByVal sqlstr As String) As SqlDataReader
If myConn.State = ConnectionState.Closed Then
myConn.Open()
End If
myCmd = New SqlCommand(sqlstr, myConn)
Dim reader As SqlDataReader
reader = myCmd.ExecuteReader
myCmd.Dispose()
Return reader
End Function
Public Sub LoadUserInfo(ByVal UserID As String)
Dim sqlstr As String = "select * from Users where UserID='" + UserID + "'"
Dim myreader As SqlDataReader = ExecReaderSql(sqlstr)
If myreader.Read Then
txtUserID.Text = myreader("UserID")
txtName.Text = myreader("username")
txtphone.Text = myreader("Phone")
txtaddress.Text = myreader("address")
txtEMail.Text = myreader("EMail")
End If
myConn.Close()
End Sub
End Class
点击查阅信息:
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>