Forum Informatika
Silahkan Login

Kami sarankan anda register atau daftar terlebih dahulu agar anda dapat mendownload atau membuka category forum secara keseluruhan....
karena ada beberapa forum yang tertutup untuk tamu dan dengan Login Anda bisa menggunakan fasilitas Chatting yang kami miliki.

Selamat Bergabung

Forum Informatika

Created By Hanafi Sukawa Ginting
 
HomeFAQPasang Iklanfacebook InformatikaRegisterLog inNew Tab Newscomputer

Share | 
 

 KONEKSI DATABASE dengan visual basic

View previous topic View next topic Go down 
AuthorMessage


Change Your Avatar -------------->


admin

Admin
Rank : Admin


My Pets :
Jumlah posting : 550
Point : 2147483647
Reputasi : 47
Join date : 2010-04-23
Age : 24
Lokasi : indonesia

PostSubject: KONEKSI DATABASE dengan visual basic   Fri 07 May 2010, 10:25




Code:
Public con As New ADODB.Connection
Public rec As New ADODB.Recordset


Public Sub koneksi()

con.Open "provider = microsoft.ace.oledb.12.0; data source = " & App.Path & "\Database1.accdb"

End Sub


Private Sub Close_Click()
Unload Me
End Sub

Private Sub cmdexit_Click()
End
End Sub

Private Sub cmdsimpan_Click()

If txtnrp.Text = "" Then
    MsgBox "Isi NRP"
    txtnrp.SetFocus
    ElseIf Len(txtnrp) < text = "" text = ""> 8 Then
    MsgBox "Semester tidak lebih dari 8"
    cmbsemester.SetFocus
    ElseIf cmbk.Text = "" Then
    MsgBox "pilih kelas"
    cmbk.SetFocus
    ElseIf cmbk.Text > 3 Then
    MsgBox "kelas yang anda pilih tidak ada"
    cmbk.SetFocus
    ElseIf cmbj = "" Then
    MsgBox "pilih jurusan"
    cmbj.SetFocus
    ElseIf cmbn.Text = "" Then
    MsgBox "pilih kelas keberapa"
    cmbn.SetFocus
    ElseIf cmbn.Text > 10 Then
    MsgBox "Kelas yang anda pilih tidak ada"
    cmbn.SetFocus
 
Else
con.Execute "insert into mahasiswa values('" &amp; txtnrp &amp; "','" &amp; txtnama &amp; "','" &amp; cmbsemester &amp; "','" &amp; cmbk + " " + cmbj + " " + "-" + " " + cmbn &amp; "')"
MsgBox "Data tersimpan", vbInformation, simpan
tampil
txtnrp.Text = ""
txtnama.Text = ""
cmbsemester.Text = ""
cmbk.Text = ""
cmbj.Text = ""
cmbn.Text = ""
txtnrp.Enabled = False
txtnama.Enabled = False
cmbsemester.Enabled = False
cmdsimpan.Enabled = False
cmbk.Enabled = False
cmbj.Enabled = False
cmbn.Enabled = False

End If



End Sub



Private Sub cmdtambah_Click()
txtnrp.Text = ""
txtnama.Text = ""
cmbsemester.Text = ""
cmbk.Text = ""
cmbj.Text = ""
cmbn.Text = ""

txtnrp.Enabled = True
txtnama.Enabled = True
cmbsemester.Enabled = True
cmdsimpan.Enabled = True
cmbk.Enabled = True
cmbj.Enabled = True
cmbn.Enabled = True

End Sub

Sub tampil()
rec.Open "Select * from mahasiswa  ", con, adOpenKeyset, adLockOptimistic
Set grid.DataSource = Nothing
Set grid.DataSource = rec
rec.Close
End Sub


Private Sub Form_Load()


koneksi
tampil

End Sub

download compile file nya



DOWNLOAD

Back to top Go down
http://software-download1001.blogspot.com/
 

KONEKSI DATABASE dengan visual basic

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Forum Informatika ::  :: VB6-
Jump to:  

Free forum | © phpBB | Free forum support | Contact | Report an abuse | Forumotion