Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:代码意思不解

1楼
lin98 发表于:2024/5/27 16:31:00
Dim dt2 As system.data.DataTable = db.ExecuteDataSet(Sql2).Tables(0)
dt2.TableName = "mx_b"
Dim t2 As Table = e.Form.Controls("Table2").Table
t2.datasource = dt2.Copy

问题1:上面代码每句代表什么意思?

问题2:db.ExecuteDataSet(Sql2).Tables(0)中的Tables(0)与Controls("Table2").Table中("Table2")的名称是否要一样?
2楼
有点蓝 发表于:2024/5/27 16:36:00
把执行sql返回的表格表单到Table2控件

Tables(0)指的是.net的datatable表格,一般对应数据库表名称

"Table2"指的是foxtable的表控件,和Tables(0)不是一回事。名称可以不一样
3楼
lin98 发表于:2024/5/27 17:43:00
没报错
Dim db = HySq-l.DataBaseFactory.CreateDatabase("mxc")
Dim Sq-l = "selec-t * from b3 
Dim dt As system.data.DataTable = db.ExecuteDataSet(Sq-l).Tables(0)
dt.TableName = "b3 "
Dim t As Table = e.Form.Controls("Table1").Table
t.datasource = dt.Copy

Dim Sq-l2 = "selec-t * from b2 ;"
Dim dt2 As system.data.DataTable = db.ExecuteDataSet(Sq-l2).Tables(0)
dt2.TableName = "b2"
Dim t2 As Table = e.Form.Controls("Table2").Table
t2.datasource = dt2.Copy


下面报错:未将对象引用设置到对象的实例。
注:"b3","b2"是数据库的表名
Dim db = HySq-l.DataBaseFactory.CreateDatabase("mxc")
Dim Sq-l = "selec-t * from b3 
Dim dt As system.data.DataTable = db.ExecuteDataSet(Sq-l).Tables("b3")
'dt.TableName = "b3 "
Dim t As Table = e.Form.Controls("Table1").Table
t.datasource = dt.Copy

Dim Sq-l2 = "selec-t * from b2 ;"
Dim dt2 As system.data.DataTable = db.ExecuteDataSet(Sq-l2).Tables("b2")
'dt2.TableName = "b2"
Dim t2 As Table = e.Form.Controls("Table2").Table
t2.datasource = dt2.Copy

Tables(0)指的是.net的datatable表格,一般对应数据库表名称

"Table2"指的是foxtable的表控件,和Tables(0)不是一回事。名称可以不一样

4楼
有点蓝 发表于:2024/5/27 20:12:00
不要随便乱想一套。只能按照黑色字的用法使用
共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 2 queries.