以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  IF问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=145710)

--  作者:jick0526
--  发布时间:2020/2/5 13:19:00
--  IF问题
老师,请问下,如果我想打开软件的用户名如果是张三的话,那么默认在加载表A,表B,表C时默认只加载10行,代码要怎么写,麻烦老师帮我写下,谢谢!
--  作者:有点蓝
--  发布时间:2020/2/5 14:12:00
--  
参考:http://www.foxtable.com/webhelp/topics/2256.htm

LoadUserSetting事件改为

If User.Name = "张三" Then
  DataTables("表A").Loadtop = 10
Else
  DataTables("表A").Loadtop = Nothing
End If
DataTables("表A").LoadFilter = ""
DataTables("表A").Load()

如果是外部表直接在BeforeLoadOuterTable事件处理即可

If e.DataTableName = "表A" AndAlso e.User.Name = "张三" Then
    e.SelectString = "Select top 10 * From {表A}"
End If