以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  SQLTable 英语列名变更成中文列名  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=100093)

--  作者:lanbor
--  发布时间:2017/5/4 17:03:00
--  SQLTable 英语列名变更成中文列名
现象:Dim Fill01 As String="GoodsNo,GoodsName,BarCode, 后面还有很多的英文列名
Dim cmd As new SQL Command
\'Dim DTb03 As DataTable \'   It is PUBLIC DataTable
cmd.Con necti
cmd.Com mandText = "Sel ect & \'"& Fill01 &"\' from {VW_BD_Product} order by GoodsNo "  \'Fill01 中装的全是英语列名。
DTb03 = cmd.Execu teReader()    \'主表
Tables(e.fo rm.name & "_table1").DataSource = DTb03 

问题:在 Tables(e.fo rm.name & "_table1") 获得记录后,我如何用代码把这些列名变更成中文名称。
         至于在Select 查询语句中提前设置 :GoodsNo AS ”中文名“ 的方法我知道的,  由于栏位过多,容易出错。


请教:1.如何在SQLTable 中选择性的变更一部分英文列名,
         2.如何设置SQLTable 仅显示多少列数量(如:设置它仅显示5列),
         3.如何把我自己选定的5列绑定到Tables(e.fo rm.name & "_table1")
         4.如何设备他的列宽。

       烦请专家赐教一2条样本语句。

 先谢谢狐表专家!
[此贴子已经被作者于2017/5/4 17:37:37编辑过]

--  作者:有点蓝
--  发布时间:2017/5/4 18:02:00
--  
参考:http://www.foxtable.com/webhelp/scr/1275.htm
--  作者:有点色
--  发布时间:2017/5/4 18:31:00
--  

1、http://www.foxtable.com/webhelp/scr/1275.htm

 

2、3、4 http://www.foxtable.com/webhelp/scr/1775.htm


 


--  作者:lanbor
--  发布时间:2017/5/4 20:24:00
--  按例子操作后部分列无显示。

按例子操作后部分列无显示。
If Vars("str107") = "0000" Then \'用户点了顶层节点
cmd.CommandText = "Select * fr om {VW_BD_Product} order by GoodsNo " \'取所有物料
Else
cmd.CommandText = "Select * fr om {VW_BD_Product} where Category=\'"& Vars("str107") &"\' order by GoodsNo"
End If
DTb03 = cmd.ExecuteReader()
Tables(e.Fo rm.name & "_Table1").DataSource = DTb03
[UnitD] As 单位,[CategoryD] as 分类,[Color] as 颜色,[UllagePercent] as 损耗,[isFlag] as 成品,[Category] fr om {VW_BD_Product} order by Category,GoodsNo","jy-dbs",True)  \' where Type=\'"& tb1("类型") &"\'"
Tables(e.Fo rm.name & "_table1").setcolvisiblewidth("GoodsName|180|GoodsNo|150|Description|200|CZ|80|UnitD|60|CategoryD|100|Color|80|Ullagepercent|80|ifFlag|60")

现象:在启用红色语句前,表中的所有列都能显示出来。
问题:在启用了红色语句后,其中的GoodsName,Ullagepercent,ifFlag 3个列没有显示。
        不知道为什么?

[此贴子已经被作者于2017/5/4 20:24:31编辑过]

--  作者:lanbor
--  发布时间:2017/5/4 20:26:00
--  
Tables(e.Fo rm.name & "_table1").setcolvisiblewidth("GoodsName|180|GoodsNo|150|Description|200|CZ|80|UnitD|60|CategoryD|100|Color|80|Ullagepercent|80|ifFlag|60")

现象:在启用红色语句前,表中的所有列都能显示出来。
问题:在启用了红色语句后,其中的GoodsName,Ullagepercent,ifFlag 3个列没有显示。

此主题相关图片如下:e2.jpg
按此在新窗口浏览图片
        不知道为什么?
此主题相关图片如下:e3.jpg
按此在新窗口浏览图片

--  作者:有点色
--  发布时间:2017/5/4 20:31:00
--  

 你的列名写错了,肯定是你的列名写错了。