⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edusendinfoform.vb

📁 管理毕业设计的管理系统 VB+SQL2000....
💻 VB
字号:
Public Class EduSendInfoForm

    Private fileName As String

    Private Sub ButtonBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonBrowse.Click
        If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
            fileName = OpenFileDialog1.FileName
            TextFileName.Text = fileName
        End If
    End Sub

    Private Sub ButtonSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSend.Click
        If TextTitle.Text.Trim() = "" Then
            MsgBox("请输入您要发布的通知标题!", MsgBoxStyle.Exclamation, "错误")
            Exit Sub
        End If

        If TextFileName.Text.Trim() = "" Then
            MsgBox("请选择您要发布的通知文档!", MsgBoxStyle.Exclamation, "错误")
            Exit Sub
        End If

        Dim response As Integer = MsgBox("确定发布该通知?", vbOKCancel + vbQuestion, "确认")
        If response = 2 Then
            Exit Sub
        End If

        Dim strUser As String = LoginForm.TextUser.Text
        Dim strSQL As String = "select ename from edu where euser='" + strUser + "'"
        Dim UserTable As DataTable = DBOperation.Search(strSQL)
        Dim strName As String = UserTable.Rows(0)("ename")

        Dim strId As String
        Dim nid As Integer
        strSQL = "select iid from information"
        UserTable = DBOperation.Search(strSQL)

        If UserTable.Rows.Count = 0 Then
            strId = "i001"
        Else
            strId = UserTable.Rows(UserTable.Rows.Count - 1)("iid")
            nid = Val(strId.Substring(1)) + 1
            If nid < 10 Then
                strId = "i00" + nid.ToString
            ElseIf nid < 100 Then
                strId = "i0" + nid.ToString
            Else
                strId = "i" + nid.ToString
            End If
        End If

        Dim fileByte() As Byte = My.Computer.FileSystem.ReadAllBytes(fileName)

        strSQL = "insert into information values('" + strId + "', '" + strName + "', '" + Now().ToString + "', '" + TextTitle.Text.Trim() + "', @icontent)"
        Dim strRow As String = "icontent"

        If DBOperation.Insert(strSQL, strRow, fileByte) Then
            MsgBox("发布通知成功!", MsgBoxStyle.OkOnly, "发布通知")
        Else
            MsgBox("发布通知失败!", MsgBoxStyle.Exclamation, "发布通知")
        End If
        TextTitle.Text = ""
        TextFileName.Text = ""
    End Sub

    Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCancel.Click
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -