Foxtable(狐表)用户栏目专家坐堂 → [求助]datatable相关方法的异步改造【已解决】


  共有3008人关注过本帖树形打印复制链接

主题:[求助]datatable相关方法的异步改造【已解决】

帅哥哟,离线,有人找我吗?
有点甜
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/12/27 16:30:00 [只看该作者]

Default Public readonly Property Item(tname As String) As DataTable

 

改成

 

Default Public readonly Property Item(tname As String) As xdDataTables


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/12/27 16:40:00 [只看该作者]

参考

 

Public Class myDatatables

Public Sub new
End Sub
Public name As String = ""

Default Public readonly Property Item(tname As String) As myDatatables
Get
    name = tname
    Return mytables
End Get
End Property

Public Function xFind(flt As String) As DataRow
    msgbox(name & " " & flt)
    Return Nothing
End Function

End Class

Public mytables = new myDatatables

readonly Property xDataTables As myDatatables
Get
Return mytables
End Get
End Property

 

调用

 

Dim dr = xDataTables("产品").xFind("产品编号 = '03'") '找出编号为03的产品


 回到顶部
帅哥哟,离线,有人找我吗?
浙江仔
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1316 积分:9484 威望:0 精华:1 注册:2010/7/21 14:20:00
  发帖心情 Post By:2018/12/27 20:04:00 [只看该作者]

非常感谢甜版,太开心了

Public Class myDatatables
Public Sub new
End Sub
Public dname As String = ""
Default Public readonly Property Item(tname As String) As myDatatables
Get
dname = tname
Return mytables
End Get
End Property

Public Function xFind(Filter As String,Optional Sort As String =""  ) As DataRow
Dim sname As String=DataTables(dname).ConnectionName
Dim cmd As new SQLCommand
Dim dt As DataTable
cmd.ConnectionName = sname
If sort > "" Then
    cmd.CommandText ="se lect  * from " + dname +" where " + Filter +  " order by " + sort
Else
    cmd.CommandText = "se lect  * from " + dname +" where " + Filter
End If
dt = cmd.ExecuteReader(True)

If dt.DataRows.count>0 Then
    Return dt.DataRows(0)
End If
Return Nothing
End Function

End Class

Public mytables = new myDatatables
readonly Property xDataTables As myDatatables
Get
Return mytables
End Get
End Property

 回到顶部
总数 13 上一页 1 2