Foxtable(狐表)用户栏目专家坐堂 → messagebox问题


  共有2447人关注过本帖树形打印复制链接

主题:messagebox问题

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111414 积分:567140 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/12/8 21:40:00 [显示全部帖子]

Dim Result As DialogResult
Result = Messagebox.Show("是否确认导入到" & e.fORm.Controls("combobox1").value & "考试成绩表中","警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
If Result = DialogResult.YES Then
    Dim dlg As new OpenFileDialog
    dlg.Filter = "Excel|*.xls;*.xlsx"
    Dim ksmc As String = trim(e.Form.controls("combobox1").value)
    Dim cmd As new SQLCommand
    cmd.C
    cmd.CommandText = "Sele  ct * from{成绩} where 考试名称 = '" & ksmc & "'"
    Dim dt As DataTable = cmd.ExecuteReader(True)
    If dlg.ShowDialog = DialogResult.OK Then
        Dim Book As New XLS.Book(dlg.FileName)
        Dim Sheet As XLS.Sheet = Book.Sheets(0)
        Dim str As String = trim(e.Form.controls("combobox1").value)
        If sheet(0,0).value.Contains(str) Then
            For n As Integer = 2 To Sheet.Rows.Count -1
                Dim dr As DataRow = dt.find("考试名称 = '" & ksmc & "' and 考号 = '" & trim(sheet(n,0).value) & "'")
                If dr IsNot Nothing Then
                    For m As Integer = 1 To sheet.Cols.count -1
                        dr(trim(sheet(1,m).value) & "_B") = val(sheet(n,m).value)
                    Next
                End If
            Next
            dt.save
        Else
            Messagebox.Show("你所选择的EXCL表第一行不包含考试名称,有可能你选错了表或选错了考试名称","警告")
        End If
        DataTables("成绩").load
    End If
End If

 回到顶部