以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  保存文件时,提示运行错误,如何解决?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=159375)

--  作者:hbfnmxb
--  发布时间:2020/12/24 8:32:00
--  保存文件时,提示运行错误,如何解决?

.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.5.29.8
错误所在事件:
详细错误信息:
定义了过多字段。

下面是按钮代码:是不是因为这个按钮代码的原因?老师帮忙给看看(应该是28个)

e.Form.Controls("Label1").Text = "正在统计平均分及最低分排名,请稍后..."
Application.DoEvents()
Dim timestart,timeend As Date
timestart=Date.now


Dim dt1 As DataTable = DataTables("专业录取线")
Dim dt2 As DataTable = DataTables("一分一档")
For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物理系列") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物理组总_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物理系列") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物理组总_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物化生") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物化生_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物化生") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物化生_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物化地") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物化地_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物化地") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物化地_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物化政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物化政_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物化政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物化政_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物生地") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物生地_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物生地") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物生地_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物生政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物生政_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物生政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物生政_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物地政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物地政_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("物地政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("物地政_低分排名") = fdr("全省排名")
    End If

Next


For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("历史系列") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("历史组总_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("历史系列") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("历史组总_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史化生") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史化生_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史化生") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史化生_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史化地") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史化地_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史化地") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史化地_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史化政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史化政_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史化政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史化政_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史生地") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史生地_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史生地") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史生地_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史生政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史生政_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史生政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史生政_低分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史地政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("平均分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史地政_均分排名") = fdr("全省排名")
    End If

Next

For Each dr As DataRow In dt1.Select("")
    Dim filter As String = "选科系列 = \'" & dr("史地政") & "\' and 录取年度 = \'" & dr("录取年度") & "\' and 最低分 = \'" & dr("最低分") & "\'"
    Dim fdr = dt2.find(filter)
    If fdr IsNot Nothing Then
        dr("史地政_低分排名") = fdr("全省排名")
    End If

Next


e.Form.Controls("Label1").Text = "平均分及最低分排名统计完成!"
timeend=Date.now
e.Form.Controls("Label1").text="耗时" & (timeend-timestart).TotalSeconds & "秒"
Messagebox.Show("项目完毕,请继续!")


窗口按钮可以运行,就是不能保存文件!保存文件的时候提示这个错误!!
[此贴子已经被作者于2020/12/24 8:33:04编辑过]

--  作者:有点蓝
--  发布时间:2020/12/24 9:28:00
--  
按钮代码可以运行,肯定就不是按钮代码的问题。检查保存的时候会触发什么事件
--  作者:hbfnmxb
--  发布时间:2020/12/24 9:54:00
--  
提示:定义了过多字段,估计是哪里?已经查了好几遍了。没找到问题出在哪里
--  作者:有点蓝
--  发布时间:2020/12/24 10:00:00
--  
压缩一下项目,如果使用的是access数据库,使用access打开数据库压缩一下数据库
--  作者:hbfnmxb
--  发布时间:2020/12/24 10:22:00
--  
使用access数据库,压缩项目,问题依旧!
--  作者:有点蓝
--  发布时间:2020/12/24 10:28:00
--  
请上传实例测试
--  作者:hbfnmxb
--  发布时间:2020/12/24 10:33:00
--  
数据量太大,240M,传不来。刚才我是这样操作了一下。窗口按钮另存文件后。关闭项目,不保存!然后打开项目,再导入窗口按钮,直接读取先前保存的。然后再保存项目。结果错误提示没有了。不提示了,运行按钮公式,一切正常。有点奇怪!!不过问题解决了。谢谢老师。
--  作者:有点蓝
--  发布时间:2020/12/24 10:48:00
--  
项目文件不要用来存储太多数据,建议使用外部数据库
--  作者:hbfnmxb
--  发布时间:2020/12/24 11:07:00
--  
嗯嗯,谢谢老师!在逐渐地学习!!
--  作者:程序猿
--  发布时间:2020/12/24 12:27:00
--  
你这样写代码,维护和查错不心累吗图片点击可在新窗口打开查看