📄 frmmain.vb
字号:
'Copyright (C) 2002 Microsoft Corporation
'All rights reserved.
'THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
'EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
'MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'Requires the Trial or Release version of Visual Studio .NET Professional (or greater).
Option Strict On
Imports System.Data.SqlClient
Imports System.Data.OleDb
Imports System.Text
Public Class frmMain
Inherits System.Windows.Forms.Form
' Initialize constants for connecting to the database
' and displaying a connection error to the user.
Protected Const SQL_CONNECTION_STRING As String = _
"Server=localhost;" & _
"DataBase=Northwind;" & _
"Integrated Security=SSPI"
Protected Const MSDE_CONNECTION_STRING As String = _
"Server=(local)\NetSDK;" & _
"DataBase=Northwind;" & _
"Integrated Security=SSPI"
' Change the path to the Northwind database, as needed. If you get a runtime
' error that the database cannot be found, make sure you have installed
' the Northwind database. See the Readme for more information.
Protected Const ACCESS_CONNECTION_STRING As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\Northwind.mdb"
Protected Const CONNECTION_ERROR_MSG As String = _
"To run this sample, you must have SQL " & _
"or MSDE with the Northwind database installed. For " & _
"instructions on installing MSDE, view the ReadMe file."
Protected DidPreviouslyConnect As Boolean = False
Protected HasCreatedSprocs As Boolean = False
Protected strConn As String
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
' So that we only need to set the title of the application once,
' we use the AssemblyInfo class (defined in the AssemblyInfo.vb file)
' to read the AssemblyTitle attribute.
Dim ainfo As New AssemblyInfo()
Me.Text = ainfo.Title
Me.mnuAbout.Text = String.Format("&About {0} ...", ainfo.Title)
End Sub
'Form overrides dispose to clean up the component list.
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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents mnuMain As System.Windows.Forms.MainMenu
Friend WithEvents mnuFile As System.Windows.Forms.MenuItem
Friend WithEvents mnuExit As System.Windows.Forms.MenuItem
Friend WithEvents mnuHelp As System.Windows.Forms.MenuItem
Friend WithEvents mnuAbout As System.Windows.Forms.MenuItem
Friend WithEvents tabApp As System.Windows.Forms.TabControl
Friend WithEvents pgeCreateSprocs As System.Windows.Forms.TabPage
Friend WithEvents pgeNoParams As System.Windows.Forms.TabPage
Friend WithEvents pgeInputParam As System.Windows.Forms.TabPage
Friend WithEvents pgeMSAccess As System.Windows.Forms.TabPage
Friend WithEvents btnCreateSprocs As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents grdProducts As System.Windows.Forms.DataGrid
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents btnGet10MostExpProds As System.Windows.Forms.Button
Friend WithEvents txtTenMostExpProds As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents btnGetProducts As System.Windows.Forms.Button
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents btnGetProductCountAndAvgPrice As System.Windows.Forms.Button
Friend WithEvents lblProductCountAndAvgPrice As System.Windows.Forms.Label
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label8 As System.Windows.Forms.Label
Friend WithEvents txtBeginningDate As System.Windows.Forms.TextBox
Friend WithEvents Label9 As System.Windows.Forms.Label
Friend WithEvents Label10 As System.Windows.Forms.Label
Friend WithEvents txtEndingDate As System.Windows.Forms.TextBox
Friend WithEvents btnCreateReport As System.Windows.Forms.Button
Friend WithEvents grdSales As System.Windows.Forms.DataGrid
Friend WithEvents lblNoSales As System.Windows.Forms.Label
Friend WithEvents pgeAllTypes As System.Windows.Forms.TabPage
Friend WithEvents cboCategoriesInputParam As System.Windows.Forms.ComboBox
Friend WithEvents cboCategoriesAllTypes As System.Windows.Forms.ComboBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain))
Me.mnuMain = New System.Windows.Forms.MainMenu()
Me.mnuFile = New System.Windows.Forms.MenuItem()
Me.mnuExit = New System.Windows.Forms.MenuItem()
Me.mnuHelp = New System.Windows.Forms.MenuItem()
Me.mnuAbout = New System.Windows.Forms.MenuItem()
Me.tabApp = New System.Windows.Forms.TabControl()
Me.pgeCreateSprocs = New System.Windows.Forms.TabPage()
Me.Label2 = New System.Windows.Forms.Label()
Me.btnCreateSprocs = New System.Windows.Forms.Button()
Me.pgeNoParams = New System.Windows.Forms.TabPage()
Me.txtTenMostExpProds = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.btnGet10MostExpProds = New System.Windows.Forms.Button()
Me.pgeInputParam = New System.Windows.Forms.TabPage()
Me.Label4 = New System.Windows.Forms.Label()
Me.grdProducts = New System.Windows.Forms.DataGrid()
Me.btnGetProducts = New System.Windows.Forms.Button()
Me.cboCategoriesInputParam = New System.Windows.Forms.ComboBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.pgeAllTypes = New System.Windows.Forms.TabPage()
Me.lblProductCountAndAvgPrice = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.btnGetProductCountAndAvgPrice = New System.Windows.Forms.Button()
Me.cboCategoriesAllTypes = New System.Windows.Forms.ComboBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.pgeMSAccess = New System.Windows.Forms.TabPage()
Me.btnCreateReport = New System.Windows.Forms.Button()
Me.txtEndingDate = New System.Windows.Forms.TextBox()
Me.Label10 = New System.Windows.Forms.Label()
Me.Label9 = New System.Windows.Forms.Label()
Me.txtBeginningDate = New System.Windows.Forms.TextBox()
Me.Label8 = New System.Windows.Forms.Label()
Me.grdSales = New System.Windows.Forms.DataGrid()
Me.lblNoSales = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.tabApp.SuspendLayout()
Me.pgeCreateSprocs.SuspendLayout()
Me.pgeNoParams.SuspendLayout()
Me.pgeInputParam.SuspendLayout()
CType(Me.grdProducts, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pgeAllTypes.SuspendLayout()
Me.pgeMSAccess.SuspendLayout()
CType(Me.grdSales, System.ComponentModel.ISupportInitialize).BeginInit()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -