-
Notifications
You must be signed in to change notification settings - Fork 1
/
VendorAdd.vb
42 lines (33 loc) · 1.47 KB
/
VendorAdd.vb
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
Imports MySql.Data.MySqlClient
Public Class VendorAdd
Dim MysqlConn As MySqlConnection
Dim COMMAND As MySqlCommand
Private Sub clear_entry()
vendorIdTextBox.Text = ""
vendorNameTextBox.Text = ""
vendorSpaceLocationTextBox.Text = ""
vendorEmailTextBox.Text = ""
vendorPhoneTextBox.Text = ""
vendorAddressTextBox.Text = ""
End Sub
Private Sub AddVendorBtn_Click(sender As Object, e As EventArgs) Handles addVendorBtn.Click
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost; userid=root; password=''; database=wareit"
Dim READER As MySqlDataReader
Try
MysqlConn.Open()
Dim Query As String
Query = "INSERT INTO wareit.vendors(vendor_id, vendor_name, vendor_space_location, vendor_email, vendor_phone, vendor_address)
VALUES('" & vendorIdTextBox.Text & "', '" & vendorNameTextBox.Text & "', '" & vendorSpaceLocationTextBox.Text & "', '" & vendorEmailTextBox.Text & "', '" & vendorPhoneTextBox.Text & "', '" & vendorAddressTextBox.Text & "')"
COMMAND = New MySqlCommand(Query, MysqlConn)
READER = COMMAND.ExecuteReader
MessageBox.Show("Data Inserted Successfully")
clear_entry()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
End Class