Advertisement
endarfernandes

tambahan kodingan simpan

Nov 26th, 2016
2,218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim datauser As ADODB.Recordset
  2. Sub aktif()
  3.     txtnama.Enabled = True
  4.     txtjurusan.Enabled = True
  5.     txtnohp.Enabled = True
  6. End Sub
  7. Sub nonaktif()
  8.     txtnim.Enabled = False
  9.     txtnama.Enabled = False
  10.     txtjurusan.Enabled = False
  11.     txtnohp.Enabled = False
  12. End Sub
  13. Sub bersih()
  14.     txtnim.Text = ""
  15.     txtnama.Text = ""
  16.     txtjurusan.Text = ""
  17.     txtnohp.Text = ""
  18. End Sub
  19.  
  20. Private Sub cmdinput_Click()
  21.     If cmdinput.Caption = "INPUT" Then
  22.         aktif
  23.         cmdinput.Caption = "SIMPAN"
  24.         txtnama.SetFocus
  25.     ElseIf cmdinput.Caption = "SIMPAN" Then
  26.         Set datauser = New ADODB.Recordset
  27.         query = "insert into mahasiswa values ('" & txtnim.Text & "', '" & txtnama.Text & "','" & txtjurusan.Text & "','" & txtnohp.Text & "')"
  28.         conn.Execute query
  29.         Set datauser = New ADODB.Recordset
  30.         datauser.Open "select * from mahasiswa", conn
  31.         Set DataGrid1.DataSource = datauser
  32.         MsgBox "Data Berhasil Disimpan"
  33.     End If
  34. End Sub
  35.  
  36. Private Sub Form_Load()
  37.     bersih
  38.     nonaktif
  39.     Set datauser = New ADODB.Recordset
  40.     datauser.Open "select * from mahasiswa", conn
  41.     Set DataGrid1.DataSource = datauser
  42. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement