以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  报表BindTables绑定MSSQL出现乱码  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=80940)

--  作者:wizscn
--  发布时间:2016/2/13 15:17:00
--  报表BindTables绑定MSSQL出现乱码

Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
rt.Height = 50
rt.Style.GridLines.All = New prt.Linedef  \'设置网格线
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center  \'水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center  \'垂直居中
Dim tb As Table = Tables(e.Form.Name & "_Table1" )

For c  As  Integer = 0 To tb.Cols.Count -1
    rt.Cells(0,c).Text = tb.Cols(c).Name
    rt.Cols(c).Width = tb.Cols(tb.Cols(c).Name).PrintWidth
    rt.Cells(1, c).Text = "[Fields!" & tb.Cols(c).Name &  ".Value]"  \'设置绑定表达式
Next
rt.RowGroups(0,1).Style.TextAlignVert = prt.AlignVertEnum.Center \'第一行内容垂直居中
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'将第一行作为表头.
rt.RowGroups(1,1).DataBinding.DataSource = BindTables(e.Form.Name & "_Table1") \'将第二行绑定到订单表
doc.Body.Children.Add(rt)
doc.Preview()

运行结果是:

 

 
图片点击可在新窗口打开查看此主题相关图片如下:vey4c3ka6(ytcjwz0jf3vn.gif
图片点击可在新窗口打开查看

 
难道这个不能绑定MSSQL,而只能绑定内部的表么?

[此贴子已经被作者于2016/2/13 15:20:37编辑过]

--  作者:Hyphen
--  发布时间:2016/2/13 15:43:00
--  
测试没有问题,去掉这一行试试:rt.Height = 50
--  作者:wizscn
--  发布时间:2016/2/13 16:22:00
--  
太感谢了。初学的看来基础不扎实。