Foxtable(狐表)用户栏目专家坐堂 → [求助]怪事,发布后运行正常,一切换到远程数据库,就出错啦


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

主题:[求助]怪事,发布后运行正常,一切换到远程数据库,就出错啦

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


加好友 发短信
等级:婴狐 帖子:95 积分:1029 威望:0 精华:0 注册:2011/8/13 14:57:00
[求助]怪事,发布后运行正常,一切换到远程数据库,就出错啦  发帖心情 Post By:2014/8/14 9:08:00 [只看该作者]

怪事,发布后运行正常,一切换到远程数据库,就提示

.NET Framework 版本:2.0.50727.4984
Foxtable 版本:2014.8.13.1
错误所在事件:窗口,片区欠费窗口,Button1,Click
详细错误信息:
未将对象引用设置到对象的实例。

是什么原因?

同样的类似问题,之前也有出现过,没有管他,也就没有解决,现在又出现了,困惑中???
[此贴子已经被作者于2014-8-14 9:09:20编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2014/8/14 9:09:00 [只看该作者]

错误所在事件:窗口,片区欠费窗口,Button1,Click

代码发出来看看

 回到顶部
帅哥哟,离线,有人找我吗?
ywlin521
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:95 积分:1029 威望:0 精华:0 注册:2011/8/13 14:57:00
  发帖心情 Post By:2014/8/14 9:11:00 [只看该作者]

Functions.Execute("DataOperationYN",False,False,False)
Functions.Execute("LoadProgressInfo")
For Each fm As WinForm.Form In Forms
    If fm.Name <> "片区欠费窗口" Then fm.Close()
Next

Tables("片区欠费窗口_Table1").StopRedraw()
Tables("片区欠费窗口_Table2").StopRedraw()

''''''
Dim ye As String = Nothing

If e.Form.Controls("rb-1").Checked Then
    ye = " and [余额] < 0 "
ElseIf e.Form.Controls("rb1").Checked
    ye = " and [余额] > 0 "
ElseIf e.Form.Controls("rb0").Checked
    ye = " and [余额] = 0 "
Else
    ye = ""
End If

Dim s3 As String = Nothing
Dim NdDr As DataRow = Nothing
Dim fName As String = Nothing
For Each nd As WinForm.TreeNode In e.Form.Controls("TreeView1").AllNodes
    If nd.Checked Then
        fName = nd.FullName
        fName = fName.Replace("\",".")
        NdDr = DataTables("dwZzjg").Find("级码 = '" & fName & "'" )
        s3 &= "'" & NdDr("_Identify") & "',"

        's3 &= "'" & nd.DataRow("_Identify") & "',"
    End If
Next
If s3 Is Nothing Then
    MessageBox.Show("请选择校区","提示",MessageBoxButtons.OK,MessageBoxIcon.Information )
    Tables("片区欠费窗口_Table1").ResumeRedraw()
    Tables("片区欠费窗口_Table2").ResumeRedraw()
    Return
Else
    s3 = s3.TrimEnd(",")
End If

Functions.Execute("LoadDatatableFalse","tbStudy","[学习校区Identify] in (" & s3 & ")  " )

Dim dt As DataTable = DataTables("tbStudy")
Dim xhs As List(of String) = dt.GetValues("学号")
If xhs.Count = 0 Then
    MessageBox.Show("人数为0","提示",MessageBoxButtons.OK,MessageBoxIcon.Information )
    Tables("片区欠费窗口_Table1").ResumeRedraw()
    Tables("片区欠费窗口_Table2").ResumeRedraw()
    Return
End If

Dim jb As New SQLJoinTableBuilder("校区片区欠费统计表","tbStudy")
jb.ConnectionName = connName
jb.AddTable("tbStudy","学号","tbStudentInfo","学号")
jb.AddCols("{tbStudentInfo}.学号","{tbStudentInfo}.姓名","拼音","性别","学校","届次","{tbStudentInfo}.班级","第一联系","第二联系","第三联系","期次")

Dim sfilter As String = Nothing
For Each s As String In xhs
    sfilter &= "'" & s & "',"
Next
sfilter = sfilter.TrimEnd(",")

jb.Filter = "[学习校区Identify] in (" & s3 & ")  " & " And {tbStudentInfo}.学号 In (" & sfilter & ")"
jb.Distinct = True
'jb.Build()

'With Tables("校区片区欠费统计表")
With Tables("片区欠费窗口_Table1")
    .DataSource = jb.BuildDataSource
    '.StopRedraw()
    
    If .Cols.Contains("所报课程") = False Then  .DataTable.DataCols.Add("所报课程",Gettype(String),500)
    If .Cols.Contains("应交学费") = False Then  .DataTable.DataCols.Add("应交学费",Gettype(Double))
    If .Cols.Contains("实交学费") = False Then  .DataTable.DataCols.Add("实交学费",Gettype(Double))
    If .Cols.Contains("折扣金额") = False Then  .DataTable.DataCols.Add("折扣金额",Gettype(Double))
    If .Cols.Contains("优惠金额") = False Then  .DataTable.DataCols.Add("优惠金额",Gettype(Double))
    If .Cols.Contains("欠费金额") = False Then  .DataTable.DataCols.Add("欠费金额",Gettype(Double))
    
    If .Rows.Count > 0 Then
        Dim drs As List(of DataRow) = Nothing
        Dim s As String = Nothing
        
        Dim qcs As List(of String) = Nothing
        For Each r As Row In .Rows
            drs = dt.Select("学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听')   " & ye)
            
            s = Nothing
            For Each dr As DataRow In drs
                s &= dr("课程") & ","
            Next
            s = s.TrimEnd(",")
            r("所报课程") = s
            
            r("应交学费") = dt.Compute("sum(应交学费)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听')   " & ye)
            r("实交学费") = dt.Compute("sum(实交学费)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听')   " & ye)
            r("折扣金额") = dt.Compute("sum(折扣金额)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听')   " & ye)
            r("优惠金额") = dt.Compute("sum(优惠金额)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听')   " & ye)
            r("欠费金额") = dt.Compute("sum(余额)","学号 = '" & r("学号") & "' and 期次 = '" & r("期次") & "' And 状态 in ('正常','试听')   " & ye)
        Next
    End If
    .AutoSizeCols()
    .Sort = "届次,学校,班级"
    .Cols("拼音").Visible = False
    .AllowEdit = False
    '.ResumeRedraw()
    
    .Grid.AllowFiltering = True
    .Grid.AllowFreezing = True
End With

''''''
'StatusBar.Message1 = "共有【" & Tables("校区片区欠费统计表").Rows.Count & "】条学生缴费信息"
StatusBar.Message1 = "共有【" & Tables("片区欠费窗口_Table1").Rows.Count & "】条学生缴费信息"

With Tables("片区欠费窗口_Table1")
    '.DataSource = DataTables("校区片区欠费统计表")
    'Tables("片区欠费窗口_Table1").ResumeRedraw()
    .ResumeRedraw
    .Grid.AllowFiltering = True
    .AllowEdit = False
    
    .Cols("应交学费").GrandTotal = True
    .Cols("实交学费").GrandTotal = True
    .Cols("折扣金额").GrandTotal = True
    .Cols("优惠金额").GrandTotal = True
    .Cols("欠费金额").GrandTotal = True
    .GrandTotal = True
    
    .AutoSizeCols()
End With

With Tables("片区欠费窗口_Table2")
    .ResumeRedraw()
End With

Functions.Execute("TableStyle","片区欠费窗口_Table1")
Functions.Execute("TableStyle","片区欠费窗口_Table2")

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2014/8/14 9:15:00 [只看该作者]

建议您用这个方法:
http://www.foxtable.com/help/topics/1485.htm

先找出是哪一行出错,然后分析原因,搞不定,贴出代码,并告诉我们运行到哪一行出错。

 回到顶部