📄 s_mark_infor.aspx.vb
字号:
Public Class s_mark_infor
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox4 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox5 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox11 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox12 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox13 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox14 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents HyperLink10 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink11 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink9 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink13 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink14 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink15 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink8 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink5 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 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
Dim student_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
'将student_mark表中的各项成绩绑顶到数据控件textbox1-14上
Dim dsn As String = ConfigurationSettings.AppSettings("DSN_student")
Dim conn As New SqlClient.SqlConnection
conn.ConnectionString = dsn
Dim cmd1 As New SqlClient.SqlCommand
Dim cmd2 As New SqlClient.SqlCommand
cmd1.Connection = conn
cmd2.Connection = conn
Dim ds1 As DataSet = New DataSet
Dim mydap1 As New SqlClient.SqlDataAdapter
Dim mydap2 As New SqlClient.SqlDataAdapter
Dim bool1 As Boolean = False
mydap1.SelectCommand = cmd1
mydap2.SelectCommand = cmd2
cmd1.CommandText = "SELECT * FROM student_mark WHERE s_id='" + student_id + "'"
'cmd2.CommandText = "select * from mark_rate where " '取出各项的权重值,不会从学号中提取系别
Try
conn.Open()
mydap1.Fill(ds1, "student_mark")
bool1 = True
Catch
Label1.Text = "读取学生成绩失败,可能是服务器出现错误,请稍后再试!非常抱歉影响了您的工作!"
Finally
conn.Close()
End Try
Dim mytable1 As New DataTable
If bool1 Then
mytable1 = ds1.Tables("student_mark")
'如果数据表中存在此学生的纪录,则绑定,否则提示还没有成绩
If mytable1.Rows.Count <> 0 Then
TextBox1.Text = mytable1.Rows(0)("Lab1_mark")
TextBox2.Text = mytable1.Rows(0)("Lab2_mark")
TextBox3.Text = mytable1.Rows(0)("Lab3_mark")
TextBox4.Text = mytable1.Rows(0)("Lab4_mark")
TextBox5.Text = mytable1.Rows(0)("Lab5_mark")
'textbox11.Text = 需要计算
TextBox12.Text = mytable1.Rows(0)("exercise_mark")
TextBox13.Text = mytable1.Rows(0)("exam_mark")
'textbox14.Text = 需要计算
Else
Label1.Text = "您暂时还没有任何成绩,请以后查询!"
End If
End If
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -