Foxtable(狐表)用户栏目专家坐堂 → 代码纠错


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

主题:代码纠错

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


加好友 发短信
等级:一尾狐 帖子:461 积分:4295 威望:0 精华:0 注册:2019/8/5 17:49:00
代码纠错  发帖心情 Post By:2022/3/10 13:13:00 [只看该作者]

Tables("试题").StopRedraw
Tables("试题").Filter = ""
Tables("试题").Sort = ""
For i As Integer = 0 To Tables("试题").rows.count -1
    Tables("试题").Rows(i)("随机值") = Rand.Next(10000)
Next '排随机值
For Each dr As DataRow In DataTables("试题").DataRows
    dr("信息") = Nothing
    dr("序号") = Nothing
Next '清空指定列的数据
Dim fls As List(Of String) = DataTables("试题").GetUniqueValues("","分类")
Dim txs As List(Of String) = DataTables("试题").GetUniqueValues("","题型")
For Each fl As String In fls
For Each tx As String In txs
    '获得该分类的全部行
    Dim drs As List(Of DataRow) = DataTables("试题").Select("[分类] = '" & fl & "'" And "[题型] = '" & tx & "'", "随机值")
    For n As Integer = 0 To drs.Count - 1 '遍历所有行
        drs(n)("序号") = n + 1 '编号排序
    Next
Next
Next
Dim Str As String
For Each fl As String In fls
For Each tx As String In txs
    Dim dr As DataRow = DataTables("组题方式").Find("[模块] = '" & fl & "'" And "[题型] = '" & tx & "'")
    '组合字符串
    str = str & " or [分类] = '" & fl & "' And [组题] <= " & dr(Vars("考试类别"))*100
Next '筛选
Next
Tables("试题").Filter = str.SubString(4)
Tables("试题").Sort = "随机值,题型"
For i As Integer = 0 To Tables("试题").rows.count -1
    Tables("试题").Rows(i)("序号") = i + 1
Next '对序号我按筛选行的顺序赋值
Tables("试题").ResumeRedraw


蓝总:内部函数运行时报错

图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20220310124005.png
图片点击可在新窗口打开查看


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


加好友 发短信
等级:超级版主 帖子:110450 积分:562116 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/3/10 13:46:00 [只看该作者]

如果还是理解不了,考虑使用这种方式:http://www.foxtable.com/webhelp/topics/2919.htm

Dim drs As List(Of DataRow) = DataTables("试题").Select("[分类] = '" & fl & "' And [题型] = '" & tx & "'", "随机值")

 回到顶部