Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Then
- MessageBox.Show("Data Belum Lengkap", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
- Exit Sub
- Else
- Dim nomor As String = Microsoft.VisualBasic.Left(TextBox5.Text, 2)
- If nomor <> "08" Then
- MessageBox.Show("Isi Nomer Telepon Anda Dengan Benar", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
- TextBox5.Text = ""
- Exit Sub
- End If
- Call Panggil_Kode()
- Dim newtext As String
- Dim oldtext As String = foto.Text
- newtext = oldtext.Replace("\", "\\")
- If Not dr.HasRows Then
- Dim SIMPAN As String = "INSERT INTO petugas VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & newtext & "','" & ComboBox1.Text & "')"
- cmd = New OdbcCommand(SIMPAN, conn)
- cmd.ExecuteNonQuery()
- MessageBox.Show("Data Berhasil Disimpan", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Information)
- Else
- Dim EDIT As String = "UPDATE petugas set nama_petugas='" & TextBox2.Text & "',username='" & TextBox3.Text & "',password='" & TextBox4.Text & "',telp='" & TextBox5.Text & "',foto='" & newtext & "',level='" & ComboBox1.Text & "' where id_petugas='" & TextBox1.Text & "'"
- cmd = New OdbcCommand(EDIT, conn)
- cmd.ExecuteNonQuery()
- MessageBox.Show("Data Berhasil Diubah", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
- Call TampilGrid()
- Call bersihkan()
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement