引用CGlbDll 和 对象库,然后可以方便的在网页中使用对象层,如下所示:获取所有的Role对象,并且显示RoleName
代码如下所示:
--------------------------------------------------------------------------------------
Imports AgileSoft.CGlbDll
Imports AgileSoft.SysEccLib
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Public xCn As Data.IDbConnection
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not AgileSoft.CGlbDll.CGlbSharedMethods.GetDbConnect(xCn, "sa", "tiankelafei", "wujingmis", "ibm") Then
Me.TextBox1.Text = Me.TextBox1.Text & "连接数据库失败" & vbCrLf
Exit Sub
End If
Dim xColRole As AgileSoft.SysEccLib.CColSysRole
If Not CEngSysRole.GetColSysRoleBySQL(xColRole) Then
Me.TextBox1.Text = Me.TextBox1.Text & "返回对象失败" & vbCrLf
Exit Sub
End If
Dim xClsRole As CClsSysRole
For Each xClsRole In xColRole
Me.TextBox1.Text = Me.TextBox1.Text & xClsRole.RoleName & vbCrLf
Next
End Sub
End Class
运行效果如图: