1. Buka SQL Server 2005 kemudian login
-> conect.
2. Buat datadase baru, klik kanan pada
database -> new database -> beri nama dan pilih lokasi penyimpanan ->
ok. seperti gambar berikut.
3. Pada database datamahasiswa buat tabel baru.
klik kanan pada tabel -> pilih new table. seperti gambar berikut.
4. klik kanan pada tabel yang baru dibuat pilih
modify. isikan seperti gambar dibawah.
5. Isi tabel, klik kanan -> open table. isi
seperti berikut. Kemudian save beri nama tabel.
6. Buka Visual Basic 2010, buat project baru. pilih menu data -> add new data source -> database -> dataset.
7. New conection pilih SQL server 2005.
Isikan seperti berikut.
8. Centang pada tabel.
9. Maka akan tampil data sources. pada jurusan pilih combob.
10. Drag and drop data sources kedalam form kemudian hapus tombol-tombol
navigasinya.
11. Desain form seperti berikut.
Juga tambahkan button-button yang diperlukan.
Listing program
-> Button "Pertama"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TbmahasiswaBindingSource.MoveFirst()
End Sub
-> Button "Sebelumnya"
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.TbmahasiswaBindingSource.MovePrevious()
End Sub
-> Button "Selanjutnya"
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.TbmahasiswaBindingSource.MoveNext()
End Sub
-> Button "Terakhir"
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.TbmahasiswaBindingSource.MoveLast()
End Sub
-> Button "Tambah"
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.TbmahasiswaBindingSource.AddNew()
End Sub
-> Button "Simpan"
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.Validate()
Me.TbmahasiswaBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DatamahasiswaDataSet)
End Sub
-> Button "Hapus"
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Me.TbmahasiswaBindingSource.RemoveCurrent()
End Sub
-> Button "Pencarian nama"
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim carinama As String
Dim posisi As Integer = 1
carinama = InputBox("Masukkan Nama", "Cari Nama")
If (TbmahasiswaBindingSource.Find("Nama", carinama)) > -1 Then
MsgBox("Data Ditemukan", vbOKOnly, "Pencarian Data")
Me.TbmahasiswaBindingSource.Position = TbmahasiswaBindingSource.Find("Nama", carinama)
posisi = TbmahasiswaBindingSource.Find("Nama", carinama) + 1
Else
MsgBox("Data Tidak Ditemukan", vbOKOnly, "Pencarian Data")
End If
End Sub
-> Button "Keluar"
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If (MsgBox("Anda yakin ingin keluar ?", vbQuestion + vbYesNo + vbDefaultButton2, "Keluar")) = vbYes Then
Me.Close()
End If
End Sub
07.36 |
Category: |
0
komentar