窗口选择数据规范可以用来显示临时数据,比如数据透视表的原数据。还有比如“数据管理模块”中显示前100条数据我们就使用了这种功能。
在任何需要显示临时数据的场景我们都可以考虑使用此数据规范。
使用此数据规范有两种方式,一种就是通过数据规范,另外一种就是通过代码。
我们先来看看在数据规范里面如何设置。
代码
直接显示指定的DataTableHelp中的数据。
C# |
sanMuSoft.Data.Database db = Proj.SysDataFactory["DBMain"]; string strSQL = "select * from tableName"; FormSelectClient frmSelect = new FormSelectClient(); frmSelect.DataTableHelp = db.ExecuteDataTableHelp(strSQL); frmSelect.SelectModel = SelectModelEnum.ViewOnly; frmSelect.Editable = false; frmSelect.IsSystemForm = false; SelectForm frm = new SelectForm("frmSQLPreview", CurrentNodeText + "_预览", null, frmSelect); frm.ShowDialog(); |
VB.Net |
Dim db As sanMuSoft.Data.Database = Proj.SysDataFactory("DBMain") Dim strSQL As String = "select * from tableName" Dim frmSelect As FormSelectClient = New FormSelectClient() frmSelect.DataTableHelp = db.ExecuteDataTableHelp(strSQL) frmSelect.SelectModel = SelectModelEnum.ViewOnly frmSelect.Editable = False frmSelect.IsSystemForm = < /FONT > False Dim frm As SelectForm = New SelectForm("frmSQLPreview", CurrentNodeText & "_预览", Nothing, frmSelect) frm.ShowDialog() |
根据RuleID来显示数据。如果我们已经通过数据规范设置了一个窗口选择规范,然后想直接用代码调用时,可以直接通过下面的代码来调用。
C# |
FormSelectClient frmSelect = new FormSelectClient("d2772b7ca74b43658ec913499d1bd9fb"); SelectForm frm = new SelectForm("frmSQLPreview", CurrentNodeText + "_预览", null, frmSelect); frm.ShowDialog(); |
VB.Net |
Dim frmSelect As FormSelectClient = New FormSelectClient("d2772b7ca74b43658ec913499d1bd9fb") Dim frm As SelectForm = New SelectForm("frmSQLPreview", CurrentNodeText & "_预览", Nothing, frmSelect) frm.ShowDialog() |