-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeverages.vb
More file actions
93 lines (87 loc) · 3.97 KB
/
Copy pathbeverages.vb
File metadata and controls
93 lines (87 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Imports Microsoft.SqlServer
Imports MySql.Data.MySqlClient
Imports Mysqlx
Imports System.Data.SqlTypes
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
'Imports MySql.Data.MySqlClient
Imports Microsoft.VisualBasic.ApplicationServices
Imports Microsoft.Win32
Imports System.Drawing.Printing
'Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Public Class beverages
Dim sqlconn As New MySqlConnection
Dim sqlcmd As New MySqlCommand
Dim sqlrd As MySqlDataReader
Dim sqldt As New DataTable
Dim dataadp As New MySqlDataAdapter
Dim sqlquery As String
Dim server As String = "localhost"
Dim uname As String = "root"
Dim pass As String = "syco2@9"
Dim dbname As String = "myconnector1"
Private Sub beverages_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MaximizeBox = False
MinimizeBox = False
ControlBox = False
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
sqlconn.ConnectionString = "server=" + server + ";" + "user id =" + uname + ";" + "password=" + pass + ";" + "database=" + dbname
Try
sqlconn.Open()
sqlquery = "Insert into myconnector1.receipt(ProdName,Price,Qty,Total)
values('" & Label10.Text & "','" & Integer.Parse(Label5.Text) & "','" & TextBox1.Text & "','" & (Val(Label5.Text * Val(TextBox1.Text))) & "')"
sqlcmd = New MySqlCommand(sqlquery, sqlconn)
sqlrd = sqlcmd.ExecuteReader
sqlconn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
sqlconn.Close()
End Try
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
sqlconn.ConnectionString = "server=" + server + ";" + "user id =" + uname + ";" + "password=" + pass + ";" + "database=" + dbname
Try
sqlconn.Open()
sqlquery = "Insert into myconnector1.receipt(ProdName,Price,Qty,Total)
values('" & Label6.Text & "','" & Integer.Parse(Label4.Text) & "','" & TextBox2.Text & "','" & (Val(Label4.Text * Val(TextBox2.Text))) & "')"
sqlcmd = New MySqlCommand(sqlquery, sqlconn)
sqlrd = sqlcmd.ExecuteReader
sqlconn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
sqlconn.Close()
End Try
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
sqlconn.ConnectionString = "server=" + server + ";" + "user id =" + uname + ";" + "password=" + pass + ";" + "database=" + dbname
Try
sqlconn.Open()
sqlquery = "Insert into myconnector1.receipt(ProdName,Price,Qty,Total)
values('" & Label15.Text & "','" & Integer.Parse(Label14.Text) & "','" & TextBox3.Text & "','" & (Val(Label14.Text * Val(TextBox3.Text))) & "')"
sqlcmd = New MySqlCommand(sqlquery, sqlconn)
sqlrd = sqlcmd.ExecuteReader
sqlconn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
sqlconn.Close()
End Try
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
sqlconn.ConnectionString = "server=" + server + ";" + "user id =" + uname + ";" + "password=" + pass + ";" + "database=" + dbname
Try
sqlconn.Open()
sqlquery = "Insert into myconnector1.receipt(ProdName,Price,Qty,Total)
values('" & Label25.Text & "','" & Integer.Parse(Label24.Text) & "','" & TextBox4.Text & "','" & (Val(Label24.Text * Val(TextBox4.Text))) & "')"
sqlcmd = New MySqlCommand(sqlquery, sqlconn)
sqlrd = sqlcmd.ExecuteReader
sqlconn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
sqlconn.Close()
End Try
End Sub
End Class