Bu ornekte ADODB connection kullanılarak veritabanına bağlanılıyor, sql cumleciği ile oluşturulan ADODB recorset aracılığı ile ilgili kayıt veritabanından bulunup ilgili alanlara yerleştiriliyor...
Kendinize iyi bakın, ForumTR' siz kalmayın....
Private Sub Command5_Click()
Dim sorgu
sorgu = Text1.Text
Set conn = New ADODB.Connection
With conn
'Bağlantı icin OleDB provider ı set ediliyor...
.Provider = "Microsoft.JET.OLEDB.4.0"
' edbs.mdb icin bir bağlantı acılıyor
.Open App.Path & "\edbs.mdb"
End With
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = conn
.Open "SELECT SICILNO, ADI, SOYADI, ISEGIRISTARIHI, ISTENCIKISTARIHI, DEPARTMAN, UNVAN, BOLUMADI, LOKASYON FROM PERSONEL WHERE (SICILNO = '" + sorgu + "')", conn, adOpenStatic, adLockOptimistic
End With
If rst.BOF = True And rst.EOF = True Then
MsgBox "Veri tabanına boyle bir kayıt işlenmemiştir!", vbCritical, "DİKKAT!!!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text1.SetFocus
Exit Sub
Else
Text1.Text = rst!SICILNO
Text2.Text = rst!ADI
Text3.Text = rst!SOYADI
Text4.Text = rst!ISEGIRISTARIHI
Text5.Text = rst!ISTENCIKISTARIHI
Combo1.Text = rst!DEPARTMAN
Combo2.Text = rst!UNVAN
Combo3.Text = rst!BOLUMADI
Combo4.Text = rst!LOKASYON
Set rst = Nothing
conn.Close
End If
Command2.Enabled = True
Command3.Enabled = True
End Sub
__________________
ADODB connection,ADODB recordset ve SQL
Programlama0 Mesaj
●32 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Programlama
- ADODB connection,ADODB recordset ve SQL