default.aspx.vb
来自「旅客信息管理、酒店客房管理、各种信息查询」· VB 代码 · 共 28 行
VB
28 行
'文件名:Default.aspx.vb
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not IsPostBack) Then
Me.Page.Title = "当前位置:系统首页"
Dim MyConnectionString As String = ConfigurationManager.ConnectionStrings("MyHotelDBConnectionString").ConnectionString
Dim MySQL As String = "Select * From 酒店信息 Where 优先级=1"
Dim MyConnection As New SqlConnection(MyConnectionString)
MyConnection.Open()
Dim MyTable As New System.Data.DataTable()
Dim MyAdapter As New SqlDataAdapter(MySQL, MyConnection)
MyAdapter.Fill(MyTable)
Me.Image1.ImageUrl = "~/Images/" + MyTable.Rows(0)("首页图像")
Session("MySystemName") = MyTable.Rows(0)("系统名称")
Session("MyCompanyWebSite") = MyTable.Rows(0)("酒店网站").ToString()
Session("MyCompanyName") = MyTable.Rows(0)("酒店名称")
Session("MyCompanyAddress") = MyTable.Rows(0)("酒店地址")
Session("MyCompanyPhone") = MyTable.Rows(0)("服务电话")
Session("MyCompanyLogo") = MyTable.Rows(0)("标志图标")
If (MyConnection.State = System.Data.ConnectionState.Open) Then
MyConnection.Close()
End If
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?