📄 eb.vb
字号:
'ComboBox5
'
Me.ComboBox5.Location = New System.Drawing.Point(65, 143)
Me.ComboBox5.Name = "ComboBox5"
Me.ComboBox5.Size = New System.Drawing.Size(150, 20)
Me.ComboBox5.TabIndex = 41
'
'ComboBox4
'
Me.ComboBox4.Location = New System.Drawing.Point(65, 111)
Me.ComboBox4.Name = "ComboBox4"
Me.ComboBox4.Size = New System.Drawing.Size(150, 20)
Me.ComboBox4.TabIndex = 40
'
'ComboBox3
'
Me.ComboBox3.Location = New System.Drawing.Point(65, 79)
Me.ComboBox3.Name = "ComboBox3"
Me.ComboBox3.Size = New System.Drawing.Size(150, 20)
Me.ComboBox3.TabIndex = 39
'
'ComboBox2
'
Me.ComboBox2.Location = New System.Drawing.Point(65, 51)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(150, 20)
Me.ComboBox2.TabIndex = 38
'
'ComboBox1
'
Me.ComboBox1.Location = New System.Drawing.Point(65, 23)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(150, 20)
Me.ComboBox1.TabIndex = 37
'
'Label9
'
Me.Label9.Location = New System.Drawing.Point(288, 144)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(32, 12)
Me.Label9.TabIndex = 36
Me.Label9.Text = "网卡"
'
'Label8
'
Me.Label8.Location = New System.Drawing.Point(17, 53)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(39, 16)
Me.Label8.TabIndex = 35
Me.Label8.Text = "DVD"
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(288, 80)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(32, 12)
Me.Label7.TabIndex = 34
Me.Label7.Text = "声卡"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(528, 25)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(40, 16)
Me.Label6.TabIndex = 33
Me.Label6.Text = "显卡"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(17, 25)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(49, 12)
Me.Label5.TabIndex = 32
Me.Label5.Text = "处理器"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(528, 81)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(48, 11)
Me.Label4.TabIndex = 31
Me.Label4.Text = "硬盘"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(288, 56)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(31, 12)
Me.Label3.TabIndex = 30
Me.Label3.Text = "内存"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(528, 145)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(48, 16)
Me.Label2.TabIndex = 29
Me.Label2.Text = "主板"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(527, 54)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(48, 16)
Me.Label1.TabIndex = 28
Me.Label1.Text = "显示器"
'
'DataGrid1
'
Me.DataGrid1.CaptionBackColor = System.Drawing.SystemColors.ActiveBorder
Me.DataGrid1.CaptionForeColor = System.Drawing.SystemColors.Desktop
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(8, 192)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(776, 105)
Me.DataGrid1.TabIndex = 28
'
'eb
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(920, 305)
Me.Controls.Add(Me.DataGrid1)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "eb"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "商品销售"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox3.ResumeLayout(False)
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Data_str(ByVal MySQL__Long As String)
Dim i, j As Integer
Dim a(15) As ComboBox
Dim If_str, Byvalstr As String
Try
MyConn.Open()
MyDataAdapter.SelectCommand = New OleDbCommand
With MyDataAdapter.SelectCommand
.CommandText = "Select Distinct Products_Typic From Products_Table"
.CommandType = CommandType.Text
.Connection = MyConn
End With
MyDataAdapter.Fill(MyDataset, "Frist_Fill_Table")
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
a(0) = ComboBox1 : a(1) = ComboBox2 : a(2) = ComboBox3 : a(3) = ComboBox4 : a(4) = ComboBox5 : a(5) = ComboBox6
a(6) = ComboBox7 : a(7) = ComboBox8 : a(8) = ComboBox9 : a(9) = ComboBox10 : a(10) = ComboBox11 : a(11) = ComboBox12
a(12) = ComboBox13 : a(13) = ComboBox14 : a(14) = ComboBox15
For i = 0 To UBound(a) - 1
a(i).Items.Clear()
Next
For i = 0 To MyDataset.Tables("Frist_Fill_Table").Rows.Count - 1
Dim MyCommand As New OleDb.OleDbCommand
Dim str_Text As OleDbDataReader
If_str = MyDataset.Tables("Frist_Fill_Table").Rows(i).Item(0)
Byvalstr = "Select * From Products_Table Where Products_Typic='" & If_str & "'and Products_Quantity>=1 and Products_Ctypic='" & MySQL__Long & "'"
MyCommand.CommandText = Byvalstr
MyCommand.CommandType = CommandType.Text
MyCommand.Connection = MyConn
str_Text = MyCommand.ExecuteReader()
Do While str_Text.Read
a(i).Items.Add(str_Text("Products_Produce") + " " + str_Text("Products_Type") & " " & str_Text("Products_Typic"))
Loop
MyCommand.Dispose()
str_Text.Close()
str_Text = Nothing
MyCommand = Nothing
str_Text = Nothing
Next
MyConn.Close()
MyDataset.Reset()
End Sub
Private Sub showmsg(ByVal a As String, ByVal b As String, ByVal c As String)
DataGrid1.CaptionText = "你所选择的 " & a & " " & b & " " & c & " 信息资料"
Debug.Write(a & " - " & b & " - " & c)
Try
If MyConn.State = ConnectionState.Closed Then
MyConn.Open()
End If
MyDataAdapter.SelectCommand = New OleDbCommand
With MyDataAdapter.SelectCommand
.CommandText = "Select Products_ID as 主键,Products_Type as 产品型号,Products_typic as 产品类型,Products_produce as 产品厂家,Products_Quality as 产品质保,Products_OutPrice as 外部价格,Products_Prove as 产品说明,Products_img as 产品图片,Products_Ctypic as 所属类型 From Products_Table Where Products_Type='" & b & "' and Products_Produce='" & a & "'"
.CommandType = CommandType.Text
.Connection = MyConn
End With
MyDataAdapter.Fill(MyDataset, "Fill_Table")
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
DataGrid1.DataSource = MyDataset.Tables("Fill_Table")
MyDataset.Reset()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Data_str("组装电脑")
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Data_str("笔记本电脑")
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim str = Split(ComboBox1.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Dim str = Split(ComboBox2.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
Dim str = Split(ComboBox3.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
Dim str = Split(ComboBox4.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox5.SelectedIndexChanged
Dim str = Split(ComboBox5.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox6_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox6.SelectedIndexChanged
Dim str = Split(ComboBox6.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox7_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox7.SelectedIndexChanged
Dim str = Split(ComboBox7.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox8_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox8.SelectedIndexChanged
Dim str = Split(ComboBox8.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox9_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox9.SelectedIndexChanged
Dim str = Split(ComboBox9.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox10_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox10.SelectedIndexChanged
Dim str = Split(ComboBox10.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox11_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox11.SelectedIndexChanged
Dim str = Split(ComboBox11.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox12_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox12.SelectedIndexChanged
Dim str = Split(ComboBox12.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox13_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox13.SelectedIndexChanged
Dim str = Split(ComboBox13.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox14_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox14.SelectedIndexChanged
Dim str = Split(ComboBox14.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub ComboBox15_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox15.SelectedIndexChanged
Dim str = Split(ComboBox15.Text)
showmsg(str(0), str(1), str(2))
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
REM 新增
If MyConn.State = ConnectionState.Closed Then
MyConn.Open()
End If
MyDataAdapter.SelectCommand = New OleDbCommand
With MyDataAdapter.SelectCommand
.CommandText = "Select * From SELL_TABLE"
.CommandType = CommandType.Text
.Connection = MyConn
End With
MyDataAdapter.Fill(MyDataset, "Sell_Table")
MyRow = MyDataset.Tables("Sell_Table").NewRow
MyRow(1) = ComboBox1.Text
MyRow(2) = ComboBox2.Text
MyRow(3) = ComboBox3.Text
MyRow(4) = ComboBox4.Text
MyRow(5) = ComboBox5.Text
MyRow(6) = ComboBox6.Text
MyRow(7) = ComboBox7.Text
MyRow(8) = ComboBox8.Text
MyRow(9) = ComboBox9.Text
MyRow(10) = ComboBox10.Text
MyRow(11) = ComboBox11.Text
MyRow(12) = ComboBox12.Text
MyRow(13) = ComboBox13.Text
MyRow(14) = ComboBox14.Text
MyRow(15) = ComboBox15.Text
MyRow(16) = "未交费"
MyRow(17) = "未装机"
MyRow(18) = ""
MyRow(19) = Now
MyDataset.Tables("Sell_Table").Rows.Add(MyRow)
Try
Dim Cmm As New OleDbCommandBuilder(MyDataAdapter)
MyDataAdapter.Update(MyDataset, "Sell_Table")
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Data_str("组装电脑")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Data_str("品牌电脑")
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
MyDataAdapter.Dispose()
MyDataset.Dispose()
MyDataset.Reset()
MyConn.Close()
Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -