Advertisement
Guest User

Untitled

a guest
Apr 1st, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. ' Gambas class file
  2.  
  3. Private koneksi As New Connection
  4. qry As String
  5. rs As Result
  6.  
  7. Sub konek_db()
  8. With koneksi
  9. .Type = "mysql"
  10. .host = "localhost"
  11. .user = "root"
  12. .password = "12345"
  13. .name = "akademik"
  14. End With
  15.  
  16.  
  17.  
  18. End
  19.  
  20. Public Sub Form_Open()
  21.  
  22. koneksi = New Connection
  23.  
  24. End
  25.  
  26. Public Sub Form_Close()
  27.  
  28. koneksi.Close
  29.  
  30. End
  31.  
  32. Public Sub SIMPAN_Click()
  33.  
  34.  
  35. Try koneksi.Close
  36. konek_db()
  37. koneksi.Open
  38.  
  39. qry = "insert into mahasiswa values ('" & TextBox1.Text & "','" & TextBox2.Text & "', '" & TextArea1.text & "')"
  40. rs = koneksi.Exec(qry)
  41.  
  42. If Not Error Then
  43. Message.Info("sukses")
  44. Endif
  45.  
  46.  
  47. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement