以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  后台加载  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=92248)

--  作者:刘林
--  发布时间:2016/10/30 8:27:00
--  后台加载
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim xx As String = user.Group
cmd.c
cmd.CommandText = "SEL  ECT DISTINCT 考试名称,单位名称,年级代码,班级 where 学校代码 = xx From {成绩}"
dt = cmd.ExecuteReader()
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt,"考试名称|单位名称|年级代码|班级")
trv.Nodes.Insert("加载所有数据",0)

老师,分户分组用的成绩表中的”学校代码”,我想在打开一窗口时,后台加载目录树只提取该学校的考试名称,单位名称,年级代码,班级,上面句子有误,请问怎么办?

--  作者:狐狸爸爸
--  发布时间:2016/10/30 9:49:00
--  
如果学校代码列是字符型:
cmd.CommandText = "SEL  ECT DISTINCT 考试名称,单位名称,年级代码,班级 where 学校代码 =\'" &  xx & "\' From {成绩}"

如果学校代码列是数值型:
cmd.CommandText = "SEL  ECT DISTINCT 考试名称,单位名称,年级代码,班级 where 学校代码 = “ & xx & ” From {成绩}"

表达式的合成:
http://www.foxtable.com/webhelp/scr/1284.htm


--  作者:刘林
--  发布时间:2016/10/30 10:19:00
--  
哦,谢谢,另外打印分班考号表,换页不对,出现是先把所有班级一页一页显示了,才集中打印出明细呢,请指导。
Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tb As Table = Tables("打印考试用表_table1")
Dim ColNames As String() = New String(){"考号", "姓名"}
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tb.DataTable.GetValues("班级")
Dim rm As prt.RenderEmpty
tb.sort = "班级,考号"
For Each Region As String In Regions
    rm = new prt.RenderEmpty \'定义一个新的空对象
    rm.BreakBefore = prt.BreakEnum.Page \'打印前换页
    doc.Body.Children.Add(rm)
    
    rx = New prt.RenderText
    rx.Style.FontSize = 14
    rx.Style.FontBold = True
    rx.Style.Spacing.Bottom = 2
    rx.Text = "班级: " & Region & "考号表"
    doc.Body.Children.Add(rx)
    rt = New prt.RenderTable
    Doc.PageSetting.LeftMargin = 10 \'设置左边距
    Doc.PageSetting.RightMargin = 10 \'设置右边距
    Doc.PageSetting.TopMargin = 10 \'设置上边距
    Doc.PageSetting.BottomMargin = 10 \'设置下边距
    rt.Cols(0).Width = 60
    rt.Cols(1).width = 50
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt.Style.GridLines.All = New prt.LineDef(0.3,Color.black)
    rt.Style.Spacing.Bottom = 2
    rt.CellStyle.Spacing.All = 1
    rt.Style.Font = New Font("宋体", 8, FontStyle.Bold) \'设置字体
    rt.Style.Spacing.All = 1
    Rows = tb.DataTable.Select("[班级] = \'" & Region & "\'")
    For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容
        For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容
            rt.Cells(r,c).Text = tb.Rows(r)(ColNames(c))
        Next
    Next
    \'\'\'\' rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
Next
doc.Columns.Add()
doc.Columns.Add()
doc.Body.Children.Add(rt)
doc.preview()