In this sample code you will know how to connect to the database using microsoft Jet Oledb 4.0.
In this sample code you will know how to connect to the database using microsoft Jet Oledb 4.0.
API Declarations
dim rs as new adodb.recordset
dim txt as control
dim inptbx as string
dim sql as string
Rate In this sample code you will know how to connect to the database using microsoft Jet Oledb 4.0.
(1(1 Vote))
Dim txt As Control
Private Sub Command1_Click()
Dim db As New adodb.CONNECTION
Dim rs As New adodb.Recordset
Dim sql As String
Dim inptbx As String
inptbx = InputBox("Enter The First Name of the Student")
sql = "select * from tablenames where FirstName='" & inptbx & "'"
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\namedatabase.mdb"
db.Open
rs.Open sql, db, adOpenKeyset, adLockPessimistic, adCmdText
End Sub
Private Sub Command2_Click()
Dim dbs As New adodb.CONNECTION
Dim rss As New adodb.Recordset
dbs.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\namedatabase.mdb"
dbs.Open
rss.Open "select * from tablenames", dbs, adOpenKeyset, adLockPessimistic, adCmdText
With rss
.AddNew
.Fields!FirstName = Form1.txtFirstName
.Fields!LastName = Form1.txtLastName
.Fields!MiddleName = Form1.txtMiddleName
.Update
MsgBox "Saving", vbInformation
End With
End Sub
Private Sub Command3_Click()
For Each txt In Form1
If TypeOf txt Is TextBox Then
txt = ""
txtFirstName.SetFocus
End If
Next
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
In this sample code you will know how to connect to the database using microsoft Jet Oledb 4.0. Comments
No comments yet — be the first to post one!
Post a Comment