以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  获取标题名称  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=15053)

--  作者:kevin
--  发布时间:2011/12/11 11:31:00
--  获取标题名称

 

以下代码是获取项目中有表名称到 ComboBox1下拉列中。

Dim s As string

For Each dt As DataTable In DataTables

    s+ = "|" & dt.Name

Next

Forms("窗口1").Controls("ComboBox1").ComboList = s

 

我想问:如何获取项目中所有表标题名称;由于我用的表名都是英文的,而标题名称是用中文的,所以,有没有办法获取标题名称。

先谢谢了!


--  作者:czy
--  发布时间:2011/12/11 12:37:00
--  
Caption
--  作者:kevin
--  发布时间:2011/12/11 15:48:00
--  对应加载该所选的表的所有列名称

CZY老师你好!

窗体中有COMBOBOX1 和 COMBOBOX2           

由于表名是使用英文名称,标题是用中文,这是为了方便平时操作者的习惯而制定的,

请先看以下代码:

 

选择控件ComboBox1时:

e.sender.items.clear
Dim s As String
For Each dt As DataTable In DataTables
s = dt.Caption  ‘获取了项目中所有表的标题   --- (如果用   s=dt.name,则是获取项目中所有表名称)
If s <> "" Then
    e.sender.items.Add(s)
End If
Next

我现在需要:

选择ComboBox2控件时;能根据ComboBox1所选择的表标题(注意是表的标题),对应加载该表的所有列名称;


--  作者:狐狸爸爸
--  发布时间:2011/12/11 20:23:00
--  

这不是问题吧?

你设置ComboBox2的enter事件:

 

if e.form.Controls("ComboBox1“).Value IsNot Nothing then

       Dim dt AS DataTable = DataTables(e.form.Controls("ComboBox1“).Value)

       dim s as String

       for each dc as datacol in dt.datacols

           s = s & "|" & dc.name

       next

       e.form.Controls("ComboBox2“).Combolist = s

end if


--  作者:yangming
--  发布时间:2011/12/11 20:38:00
--  

s = s & "|" & dc.Caption \'  列标题

 

s = s & "|" & dc.name   \' 列名称