我自己定义了一个内部函数 函数名是:AddRdDefine
'生产来料加工入库单主表的仓库,客户,员工,部门等自定义项的方法
Dim code As String =args(0)
Dim Tablename As String=args(1)
Dim Tablecode As String=args(2)
Dim deftype As String =args(3)
Dim cztablename As String=args(4)
Dim com As new SQLCommand
com .C
Dim WhCode As String=Tables("RdRecord").Current(code)
com.CommandText="select id from "& Tablename &" where "& Tablecode &"='"& WhCode &"'"
MessageBox.Show(com.CommandText)
Dim whid As Integer=com.ExecuteScalar
Dim jb As New SQLJoinTableBuilder("客户表","defineset")
jb.C
jb.AddTable("defineset","ID","definevalue","ID")
jb.AddExp("单据类型","cType")
jb.AddExp("自定义项名称","cDefinename")
单我点击按钮时触发该函数:Functions.Execute("AddRdDefine","cWhCode","Warehouse","cWhCode","仓库","来料加工入库单自定义项信息_Table1")
但是执行完函数没有实现我想要的功能。
而我把函数换成
Dim WhCode As String=Tables("RdRecord").Current("cWhCode")
com.CommandText="select id from Warehouse where cwhcode='"& WhCode &"'"
MessageBox.Show(com.CommandText)
Dim whid As Integer=com.ExecuteScalar
Dim jb As New SQLJoinTableBuilder("仓库表","defineset")
jb.C
jb.AddTable("defineset","ID","definevalue","ID")
jb.AddExp("单据类型","cType")
jb.AddExp("自定义项名称","cDefinename")
jb.AddExp("自定义项值","cDefinevalue")
jb.Filter="cType='仓库' and isourceid='"& whid &"'"
MessageBox.Show(jb.Filter)
Tables("来料加工入库单自定义项信息_Table1").DataSource =jb.BuildDataSource()
时却能实现我要的功能,求解????