以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 导入问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=90820) |
||||||||
-- 作者:刘林 -- 发布时间:2016/9/22 11:27:00 -- 导入问题 Dim dlg As new OpenFileDialog dlg.Filter = "Excel|*.xls;*.xlsx" If dlg.ShowDialog = DialogResult.OK Then Dim Book As New XLS.Book(dlg.FileName) Dim Sheet As XLS.Sheet = Book.Sheets(0) Tables("课程表").StopRedraw() For n As Integer = 1 To Sheet.Rows.Count -1 Dim bj As String = Sheet(n,2).Value Dim jc As String = Sheet(n,3).Value Dim mc As String = sheet(n,0).value Dim dm As String = sheet(n,1).value For m As Integer = 4 To 8 Dim dr As DataRow = DataTables("课程表").Find("班级 = \'" & bj & "\'and 星期 = \'" & cstr(m-3) & "\' and 节次 = \'" & jc & "\'") If dr Is Nothing Then \'如果不存在同编号的订单 dr = DataTables("课程表").AddNew() End If dr("学校名称") = mc dr("学校代码") = dm dr("班级") = bj dr("节次") = jc dr("星期") = cstr(m-3) dr("科目") = Sheet(n,m).Value Next Next Dim kms() As String = {"语文","数学","英语","政治","历史","生物","地理","物理","化学","音乐","美术","体育","班会","微机"} \'其它科目自己添加 Sheet = Book.Sheets(1) Dim drs As List(of DataRow) For n As Integer = 3 To Sheet.Rows.Count -1 Dim bj As String = Sheet(n,0).Value For m As Integer = 0 To kms.Length - 1 If Sheet(n,m+1).Value > "" Then drs = DataTables("课程表").Select("班级 = \'" & bj & "\' and 科目 = \'" & kms(m) & "\'") For Each r As DataRow In drs r("任课教师") = Sheet(n,m+2).Value Next End If Next Next Tables("课程表").ResumeRedraw() End If 请问为什么任课教师中物理,体育导不进,其他能导入,请问哪里出事了,怎么改,谢谢
|
||||||||
-- 作者:有点蓝 -- 发布时间:2016/9/22 11:48:00 -- http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=90780&page=1&star=2 我原来的代码是If Sheet(n,m+2).Value > "" Then
|
||||||||
-- 作者:刘林 -- 发布时间:2016/9/22 15:09:00 -- 还是不行,存在的问题一是有些任课教师导不进,(星期五晚自习,有些合用晚自习除外)二是存在导入后任课教师与实际不对应,如体育教师导到了去上班会,改不出来,请帮改下,谢谢! |
||||||||
-- 作者:刘林 -- 发布时间:2016/9/22 15:14:00 -- 附件传上来请老师看下 |
||||||||
-- 作者:刘林 -- 发布时间:2016/9/22 15:14:00 --
|
||||||||
-- 作者:有点蓝 -- 发布时间:2016/9/22 15:41:00 -- 看2楼,自己跟踪数据的变化 |