frmviewcp.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:3k
- Imports System.Configuration
- Public Class frmviewcp
- Inherits System.Windows.Forms.Form
- #Region " Windows 窗体设计器生成的代码 "
- Public Sub New()
- MyBase.New()
- '该调用是 Windows 窗体设计器所必需的。
- InitializeComponent()
- '在 InitializeComponent() 调用之后添加任何初始化
- End Sub
- '窗体重写 dispose 以清理组件列表。
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
- 'Windows 窗体设计器所必需的
- Private components As System.ComponentModel.IContainer
- '注意: 以下过程是 Windows 窗体设计器所必需的
- '可以使用 Windows 窗体设计器修改此过程。
- '不要使用代码编辑器修改它。
- Friend WithEvents cpViewer As DataDynamics.ActiveReports.Viewer.Viewer
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.cpViewer = New DataDynamics.ActiveReports.Viewer.Viewer
- Me.SuspendLayout()
- '
- 'cpViewer
- '
- Me.cpViewer.BackColor = System.Drawing.SystemColors.Control
- Me.cpViewer.Dock = System.Windows.Forms.DockStyle.Fill
- Me.cpViewer.Location = New System.Drawing.Point(0, 0)
- Me.cpViewer.Name = "cpViewer"
- Me.cpViewer.ReportViewer.CurrentPage = 0
- Me.cpViewer.ReportViewer.MultiplePageCols = 3
- Me.cpViewer.ReportViewer.MultiplePageRows = 2
- Me.cpViewer.Size = New System.Drawing.Size(292, 273)
- Me.cpViewer.TabIndex = 0
- Me.cpViewer.TableOfContents.Text = "Contents"
- Me.cpViewer.TableOfContents.Width = 200
- Me.cpViewer.Toolbar.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
- '
- 'frmviewcp
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(292, 273)
- Me.Controls.Add(Me.cpViewer)
- Me.Name = "frmviewcp"
- Me.Text = "frmviewcp"
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Public strquery As String
- Public sqlString As String
- Private Sub frmviewcp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- cpprint()
- End Sub
- Private Sub cpprint()
- Try
- If sqlString = String.Empty Then
- sqlString = "select * from wz_cp where 拼音码 like '%" & strquery & "%'or 药品编号 like '%" & strquery & "%'"
- End If
- Dim rpt As New rpxck
- Dim myDS As New DataDynamics.ActiveReports.DataSources.SqlDBDataSource
- myDS.ConnectionString = ConfigurationSettings.AppSettings.Get("constr")
- myDS.SQL = sqlString
- rpt.DataSource = myDS
- Me.cpViewer.Document = rpt.Document
- rpt.Run(False)
- Catch ex As Exception
- MessageBox.Show(Me, "报表错误: " + ex.Message + "; " + ex.InnerException.Message, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End Try
- End Sub
- End Class