You create a new connection and command and then execute the command:
Public Function InsterRecord() As Integer
Dim conStr as String ="Provider=Microsoft.OLEDB.Jet.4.0;Data
Source=yourLocalDBpath"
Dim sqlStr as String = "SQL INSERT Statement Here"
Dim con As New OLEDB.OLEDBConnection(conStr)
Dim cmd As New OLEDB.OLEDBCommand(sqlStr, con)
Dim retVal as Integer
Try
con.Open()
Catch ex As OLEDB.OLEDBException
retVal =cmd.ExecuteNonQuery
Finally
con.Close()
End Try
Return retVal
End Function
"Manish Sawjiani" <Ma************@discussions.microsoft.com> wrote in
message news:4F**********************************@microsof t.com...
Hi Experts,
I am just into dot net and i want simple code for adding records into
Access
table (97) using oledb. There are no queries in the databases and there is
only one table:
Friends with the following fields: FriendID (AutoNumber) FirstName,
LastName
and DateOfBirth
Please I have tried everything. WOULD BE HIGHLY OBLIGED for HELP
Thanks all
Regards
Manish Sawjiani
--
Three Cheers to Technet for the Help!