awemployees.aspx.vb
来自「wrox出版社的另一套经典的VB2005数据库编程学习书籍,收集了书中源码,郑重」· VB 代码 · 共 35 行
VB
35 行
Option Explicit On
Option Strict On
Imports System
Imports System.Data
Imports Microsoft.Reporting.WebForms
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then
Return
End If
'The following solves the "Failed to enable constraints" error for
'WinForms, but the property is missing in WebForms
'AdventureWorksDataSet.EnforceConstraints = False
'Thus, you must create new DataSet and TableAdapter instances
Dim dsAdvWorks As New AdventureWorksDataSet
Dim taEmployees As New AdventureWorksDataSetTableAdapters.AWEmployeesTableAdapter
dsAdvWorks.EnforceConstraints = False
taEmployees.Fill(dsAdvWorks.AWEmployees)
With Me.ReportViewer1
'Optionasl code
'.ProcessingMode = ProcessingMode.Local
'Dim strPath As String = "\ReportViewer\ReportWebSite\"
'Optionally, load the client report definition file (if new)
'.LocalReport.ReportPath = strPath + "AWEmployeesWin.rdlc"
.LocalReport.DataSources.Clear()
.LocalReport.DataSources.Add(New ReportDataSource("AdventureWorksDataset_AWEmployees", dsAdvWorks.Tables(0)))
'Refresh the report with the new data
.DataBind()
End With
End Sub
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?