?? t_lab_infor.aspx.vb
字號(hào):
Public Class t_lab_infor
Inherits System.Web.UI.Page
#Region " Web 窗體設(shè)計(jì)器生成的代碼 "
'該調(diào)用是 Web 窗體設(shè)計(jì)器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList
Protected WithEvents Button3 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink
Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton
Protected WithEvents Image1 As System.Web.UI.WebControls.Image
Protected WithEvents spWelMessage As System.Web.UI.HtmlControls.HtmlGenericControl
'注意: 以下占位符聲明是 Web 窗體設(shè)計(jì)器所必需的。
'不要?jiǎng)h除或移動(dòng)它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法調(diào)用是 Web 窗體設(shè)計(jì)器所必需的
'不要使用代碼編輯器修改它。
InitializeComponent()
End Sub
#End Region
Dim dsn As String
Dim conn As New SqlClient.SqlConnection
Dim cmd As New SqlClient.SqlCommand
Dim mydap1 As New SqlClient.SqlDataAdapter
Dim ds1 As DataSet = New DataSet
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此處放置初始化頁的用戶代碼
Dim teacher_id As String = Request.Cookies("userInf").Values("userID")
If DateTime.Now.Hour >= 6 And DateTime.Now.Hour < 12 Then
spWelMessage.InnerHtml = "早上好," & Request.Cookies("userInf").Values("userID") & Request.Cookies("userInf").Values("userIdent")
ElseIf DateTime.Now.Hour >= 12 And DateTime.Now.Hour < 18 Then
spWelMessage.InnerHtml = "下午好," & Request.Cookies("userInf").Values("userID") & Request.Cookies("userInf").Values("userIdent")
Else
spWelMessage.InnerHtml = "晚上好," & Request.Cookies("userInf").Values("userID") & Request.Cookies("userInf").Values("userIdent")
End If
'數(shù)據(jù)控件連接信息
dsn = ConfigurationSettings.AppSettings("DSN_teacher")
conn.ConnectionString = dsn
cmd.Connection = conn
mydap1.SelectCommand = cmd
If Not IsPostBack Then
'綁定dropdownlist1的內(nèi)容,為實(shí)驗(yàn)序號(hào)lab_infor表中的lab_id內(nèi)容
Dim bool1 As Boolean = False
cmd.CommandText = "SELECT lab_id FROM lab_infor"
Try
conn.Open()
DropDownList1.DataSource = cmd.ExecuteReader
DropDownList1.DataTextField = "lab_id"
DropDownList1.DataBind()
bool1 = True
Catch
Label1.Text = "讀取實(shí)驗(yàn)信息表失敗,可能是服務(wù)器出現(xiàn)錯(cuò)誤,請(qǐng)稍后再試!非常抱歉影響了您的工作!"
Finally
conn.Close()
End Try
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'選擇dropdownlist1的實(shí)驗(yàn)序號(hào),查詢某個(gè)實(shí)驗(yàn)的實(shí)驗(yàn)信息
Dim bool2 As Boolean = False
cmd.CommandText = "SELECT lab_memo FROM lab_infor where lab_id='" + DropDownList1.SelectedItem.Text + "'"
Try
conn.Open()
mydap1.Fill(ds1, "lab_infor_lab_memo")
bool2 = True
Catch
Label1.Text = "讀取實(shí)驗(yàn)信息表失敗,可能是服務(wù)器出現(xiàn)錯(cuò)誤,請(qǐng)稍后再試!非常抱歉影響了您的工作!"
Finally
conn.Close()
End Try
If bool2 Then
Dim mytable2 As New DataTable
mytable2 = ds1.Tables("lab_infor_lab_memo")
TextBox1.Text = mytable2.Rows(0)("lab_memo")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'提交修改信息
cmd.CommandText = "update lab_infor set lab_memo='" + TextBox1.Text + "'where lab_id='" + DropDownList1.SelectedItem.Text + "'"
Try
conn.Open()
cmd.ExecuteReader()
Label1.Text = "修改成功!"
Catch
Label1.Text = "讀取實(shí)驗(yàn)信息表失敗,可能是服務(wù)器出現(xiàn)錯(cuò)誤,請(qǐng)稍后再試!非常抱歉影響了您的工作!"
Finally
conn.Close()
End Try
End Sub
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Response.Redirect("../login.aspx")
End Sub
End Class
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -