📄 form1.vb
字号:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写处置以清理组件列表。
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 cmbProductName As System.Windows.Forms.ComboBox
Friend WithEvents lstUnitPrice As System.Windows.Forms.ListBox
Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Friend WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter
Friend WithEvents DataSet11 As Case7_4.DataSet1
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.cmbProductName = New System.Windows.Forms.ComboBox()
Me.lstUnitPrice = New System.Windows.Forms.ListBox()
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand()
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection()
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand()
Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand()
Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand()
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter()
Me.DataSet11 = New Case7_4.DataSet1()
CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'cmbProductName
'
Me.cmbProductName.Location = New System.Drawing.Point(8, 8)
Me.cmbProductName.Name = "cmbProductName"
Me.cmbProductName.Size = New System.Drawing.Size(168, 20)
Me.cmbProductName.TabIndex = 0
'
'lstUnitPrice
'
Me.lstUnitPrice.ItemHeight = 12
Me.lstUnitPrice.Location = New System.Drawing.Point(8, 40)
Me.lstUnitPrice.Name = "lstUnitPrice"
Me.lstUnitPrice.Size = New System.Drawing.Size(272, 208)
Me.lstUnitPrice.TabIndex = 1
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice" & _
", UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued FROM Products"
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "data source=THUNDERBIRD;initial catalog=Northwind;integrated security=SSPI;persis" & _
"t security info=True;workstation id=THUNDERBIRD;packet size=4096"
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO Products(ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPr" & _
"ice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued) VALUES (@ProductNam" & _
"e, @SupplierID, @CategoryID, @QuantityPerUnit, @UnitPrice, @UnitsInStock, @Units" & _
"OnOrder, @ReorderLevel, @Discontinued); SELECT ProductID, ProductName, SupplierI" & _
"D, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLe" & _
"vel, Discontinued FROM Products WHERE (ProductID = @@IDENTITY)"
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ProductName", System.Data.SqlDbType.NVarChar, 40, "ProductName"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@SupplierID", System.Data.SqlDbType.Int, 4, "SupplierID"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CategoryID", System.Data.SqlDbType.Int, 4, "CategoryID"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@QuantityPerUnit", System.Data.SqlDbType.NVarChar, 20, "QuantityPerUnit"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@UnitPrice", System.Data.SqlDbType.Money, 8, "UnitPrice"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@UnitsInStock", System.Data.SqlDbType.SmallInt, 2, "UnitsInStock"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@UnitsOnOrder", System.Data.SqlDbType.SmallInt, 2, "UnitsOnOrder"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ReorderLevel", System.Data.SqlDbType.SmallInt, 2, "ReorderLevel"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Discontinued", System.Data.SqlDbType.Bit, 1, "Discontinued"))
'
'SqlUpdateCommand1
'
Me.SqlUpdateCommand1.CommandText = "UPDATE Products SET ProductName = @ProductName, SupplierID = @SupplierID, Categor" & _
"yID = @CategoryID, QuantityPerUnit = @QuantityPerUnit, UnitPrice = @UnitPrice, U" & _
"nitsInStock = @UnitsInStock, UnitsOnOrder = @UnitsOnOrder, ReorderLevel = @Reord" & _
"erLevel, Discontinued = @Discontinued WHERE (ProductID = @Original_ProductID) AN" & _
"D (CategoryID = @Original_CategoryID OR @Original_CategoryID IS NULL AND Categor" & _
"yID IS NULL) AND (Discontinued = @Original_Discontinued) AND (ProductName = @Ori" & _
"ginal_ProductName) AND (QuantityPerUnit = @Original_QuantityPerUnit OR @Original" & _
"_QuantityPerUnit IS NULL AND QuantityPerUnit IS NULL) AND (ReorderLevel = @Origi" & _
"nal_ReorderLevel OR @Original_ReorderLevel IS NULL AND ReorderLevel IS NULL) AND" & _
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -