www.pudn.com > studen.rar > Form2.vb


Imports System.Data 
Imports System.Data.SqlClient 
Imports System.IO 
 
Public Class Form2 
 
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
        Dim aConn As SqlConnection 
        aConn = New SqlConnection("Server=(local);user id=Sa;Password=;database=class") 
        aConn.Open() 
        TextBox5.Text() = Sno 
        Try 
            Dim selecomm As SqlCommand 
            selecomm = New SqlCommand("select 姓名 from  """ + C + """  where  学号=" + Sno + "", aConn) 
            selecomm.CommandType = CommandType.Text 
            Label6.Text = selecomm.ExecuteScalar.ToString 
            selecomm = New SqlCommand("select YEAR(GETDATE())-YEAR(出生年月) from  """ + C + """  where  学号=" + Sno + "", aConn) 
            selecomm.CommandType = CommandType.Text 
            TextBox1.Text = selecomm.ExecuteScalar.ToString 
            selecomm = New SqlCommand("select 性别 from  """ + C + """  where  学号=" + Sno + "", aConn) 
            selecomm.CommandType = CommandType.Text 
            TextBox7.Text = selecomm.ExecuteScalar.ToString 
            selecomm = New SqlCommand("select 身份证号 from  """ + C + """  where  学号=" + Sno + "", aConn) 
            selecomm.CommandType = CommandType.Text 
            TextBox3.Text = selecomm.ExecuteScalar.ToString 
            selecomm = New SqlCommand("select 籍贯 from  """ + C + """  where  学号=" + Sno + "", aConn) 
            selecomm.CommandType = CommandType.Text 
            TextBox2.Text = selecomm.ExecuteScalar.ToString 
 
            selecomm = New SqlCommand("select 政治面貌 from  """ + C + """  where  学号=" + Sno + "", aConn) 
            selecomm.CommandType = CommandType.Text 
            TextBox3.Text = selecomm.ExecuteScalar.ToString 
            selecomm = New SqlCommand("select 考生来源 from  """ + C + """  where  学号=" + Sno + "", aConn) 
            selecomm.CommandType = CommandType.Text 
            TextBox9.Text = selecomm.ExecuteScalar.ToString 
            selecomm = New SqlCommand("select 联系电话 from  """ + C + """  where  学号=" + Sno + "", aConn) 
            selecomm.CommandType = CommandType.Text 
            TextBox6.Text = selecomm.ExecuteScalar.ToString 
        Catch 
            MsgBox("请确定您点击了正确的年级!") 
        End Try 
 
        Try 
            Dim path As String 
            'Dim pa As String 
 
            path = HH 
            'PictureBox1.Image = New Drawing.Bitmap("D:\学习\VB.NET\正式版\学生管理正式版\bin\Debug\rrr\" + Sno + ".jpg") 
            ' PictureBox1.Image = New Drawing.Bitmap("C:\Documents and Settings\All Users\Documents\My Pictures\示例图片\" + Sno + ".jpg") 
            PictureBox1.Image = New Drawing.Bitmap(" " + path + " \" + Sno + ".jpg") 
 
        Catch 
 
            'Label9.Text = "无相片" 
            'MsgBox("无相片") 
        End Try 
 
        Dim ds As New DataSet 
        Dim da As SqlDataAdapter 
        Dim sql As String = "select 时间,课程名,成绩,文化课排名,综合排名 from """ + G + """  where 学号=" + Sno + " " 
        da = New SqlDataAdapter(sql, aConn) 
        da.Fill(ds) 
        DataGridView1.DataSource = ds.Tables(0) 
    End Sub 
 
    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click 
 
    End Sub 
 
    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) 
 
    End Sub 
 
    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click 
 
    End Sub 
 
    Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click 
 
    End Sub 
    Private Sub Form2_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed 
        f1.Show() 
 
    End Sub 
 
 
 
    Private Sub DataGridView1_CellContentClick_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) 
 
    End Sub 
 
    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) 
 
    End Sub 
End Class