以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 不运行SAVE (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=137171) |
-- 作者:刘林 -- 发布时间:2019/6/29 12:02:00 -- 不运行SAVE Dim dlg As New OpenFileDialog dlg.Filter = "Excel|*.xls;*.xlsx;*.csv" Dim sfz As Integer Dim xjh As Integer If dlg.ShowDialog = DialogResult.OK Then Dim cmd As New SQLCommand Dim dt As DataTable cmd.connectionname = cmd.CommandText = "SE LECT 身份证件号,学籍号,就读学校,班级 From {学生台帐}" dt = cmd.ExecuteReader() Dim Book As New XLS.Book(dlg.filename) Dim Sheet As XLS.Sheet = Book.Sheets(0) For i As Integer=0 To sheet.Cols.Count-1 If sheet(0,i).Value="身份证件号" sfz =i End If If sheet(0,i).value="学籍号" xjh=i End If Next Dim dr1 As DataRow Dim dr As DataRow For n As Integer = 1 To Sheet.Rows.Count -1 dr1 = dt.find("身份证件号=\'" & sheet(n,sfz).value & "\' and 就读学校=\'" & _usergroup & "\'") If dr1 Is Nothing dr = DataTables("学生台帐").Addnew() End If For m As Integer = 0 To sheet.Cols.count -1 dr(sheet(0,m).value)=sheet(n,m).value dr("就读学校")=_usergroup dr("所属中心校")=sszxx Next Next End If Tables("学生台帐_table1").save() 把这个保存放在导入按钮中,应该可以执行保存,但不行,但单独用同样命令做一个保存就可以呢,之前没见过这种情况
|
-- 作者:有点蓝 -- 发布时间:2019/6/29 14:48:00 -- 窗口表"学生台帐_table1"绑定的是哪个表?是主表?副本?sqltable?还是后来使用fill加载过,或者设置过DataSource? |