-
Notifications
You must be signed in to change notification settings - Fork 0
/
supplierdetail.vb
48 lines (43 loc) · 1.85 KB
/
supplierdetail.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
43
44
45
46
47
48
Imports System.Data.Odbc
Public Class supplierdetail
Sub clearField()
NameTextBox.Text=""
AddressTextBox.Text = ""
PhoneTextBox.Text = ""
SupplierIDTextBox.Hide()
SupplierIDLabel.Hide()
End Sub
Private Sub categorydetail_Load(sender As Object, e As EventArgs) Handles MyBase.Load
clearField()
End Sub
Private Sub SaveButton_Click(sender As Object, e As EventArgs) Handles SaveButton.Click
'Handle update supplier detail
If SaveButton.Text = "Update" Then
dbconnection()
command = "UPDATE supplier SET name='" & NameTextBox.Text & "',address='" & AddressTextBox.Text & "',phone='" & PhoneTextBox.Text & "' WHERE id='" & SupplierIDTextBox.Text & "'"
query = New OdbcCommand(command, conn)
query.ExecuteNonQuery()
If MessageBox.Show("Supplier information updated", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information) = DialogResult.OK Then
supplier.showData()
End If
conn.Close()
Return
End If
dbconnection()
command = "INSERT INTO supplier (id,name,address,phone) VALUES(0,'" & NameTextBox.Text & "','" & AddressTextBox.Text & "','" & PhoneTextBox.Text & "')"
query = New OdbcCommand(command, conn)
query.ExecuteNonQuery()
If MessageBox.Show("Supplier Added", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information) = DialogResult.OK Then
clearField()
supplier.showData()
End If
End Sub
Private Sub CancelButton_Click(sender As Object, e As EventArgs) Handles CancelButton.Click
clearField()
Me.Dispose()
supplier.Show()
End Sub
Private Sub supplierdetail_Closed(sender As Object, e As EventArgs) Handles Me.Closed
supplier.Show()
End Sub
End Class