Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.14-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create Table Barang;
ERROR 1046 (3D000): No database selected
mysql> use databases;
ERROR 1049 (42000): Unknown database 'databases'
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.01 sec)
mysql> create database Table;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'Table
' at line 1
mysql> create database Barang;
Query OK, 1 row affected (0.00 sec)
mysql> use Barang;
Database changed
mysql> create Table Barang;
ERROR 1113 (42000): A table must have at least 1 column
mysql> create Table Barang
-> ;
ERROR 1113 (42000): A table must have at least 1 column
mysql> create Table Barang(
-> KodeBrg char(5) primary key,
-> NamaBrg char(30),
-> HargaBeli float,
-> HargaJual float,
-> JumlahBrg integer);
Query OK, 0 rows affected (0.13 sec)
mysql>
===============================================================================================
Public Baru As Boolean
Private Sub CMDEDIT_Click()
With Adodc1.Recordset
Text5.Text = !Kodebrg
Text6.Text = !Namabrg
Text7.Text = !HargaBeli
Text10.Text = !HargaJual
Text8.Text = !JumlahBrg
End With
Text5.SetFocus
Baru = False
End Sub
Private Sub CMDHAPUS_Click()
hapus = MsgBox("Anda yakin data ini akan dihapus?", vbQuestion + vbYesNo, "Hapus Data")
If hapus = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveLast
Else
MsgBox "Data tidak jadi dihapus!", vbOKOnly + vbInformation, "Batal Menghapus "
End If
End Sub
Private Sub CMDINPUT_Click()
Baru = True
Kosong
Text5.SetFocus
End Sub
Private Sub CMDREFRESH_Click()
Adodc1.Refresh
End Sub
Private Sub CMDSIMPAN_Click()
With Adodc1.Recordset
If Baru Then .AddNew
!Kodebrg = Text5.Text
!Namabrg = Text6.Text
!HargaBeli = Val(Text7.Text)
!HargaJual = Val(Text10.Text)
!JumlahBrg = Val(Text8.Text)
.Update
.Sort = "KodeBrg"
End With
Kosong
Adodc1.Refresh
End Sub
Private Sub CMDTUTUP_Click()
PESAN = MsgBox("Yakin mau keluar?", vbYesNo + vbQuestion, "Konfirmasi")
If PESAN = vbYes Then
End
Else
End If
End Sub
Public Sub Kosong()
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text10.Text = ""
Text8.Text = ""
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "DSN=Barang"
Adodc1.RecordSource = "barang"
Adodc1.Refresh
Adodc1.Recordset.Sort = "Kodebrg"
Baru = False
End Sub