473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Adding records to MS ACCESS

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!
Nov 22 '05 #1
4 1629
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!

Nov 22 '05 #2
Thanks Scott M

This code works - BUT NOTHING Happens in the DB!!! Please Help

Regards

"Scott M." wrote:
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!


Nov 22 '05 #3
On Thu, 3 Feb 2005 20:01:02 -0800, Manish Sawjiani <Ma************@discussions.microsoft.com> wrote:

¤ 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

See if the following helps:

HOW TO: Use Microsoft Visual Basic .NET to Connect to a Microsoft Access Database and to Retrieve
Data
http://support.microsoft.com/default...b;en-us;821765
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 22 '05 #4
You need to give us what you wrote so we can troubleshoot it.

"Manish Sawjiani" <Ma************@discussions.microsoft.com> wrote in
message news:1D**********************************@microsof t.com...
Thanks Scott M

This code works - BUT NOTHING Happens in the DB!!! Please Help

Regards

"Scott M." wrote:
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!


Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sérgio Almeida | last post by:
Greetings I'm having problems adding records to an access database. What I want to do is very simple. Here is my code. __CODE_START__ dim sqlStatement sqlStatement="insert into...
6
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1...
4
by: Manish Sawjiani | last post by:
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...
0
by: brijeshmathew | last post by:
Hi I use Visual Basic 6, Service Pack 6, Microsoft ActiveX Data Objects 2.8 Library(msado15.dll) and access 2000 database using JET 4 OLE. I have an application that adds records simultaneously...
8
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
2
by: Kosmos | last post by:
Alright so I've got this Outlook code written in VBA in Access. The first part, which works, records information about appointment times based on the required days before notification of certain...
1
by: vbDavidC | last post by:
I am adding a new record to a table via a dataset/adapter. I have got the following to work for me but I am wondering if there is a better way to do this. I am having to have something in my...
2
by: darrel | last post by:
HI vb Wizards, good day, just wanted to ask if somebody there can help me iwth my problem. Am having difficulty in adding up records in my table, the table is in Microsoft Access format. It Like...
2
by: Steve | last post by:
I have zero experience with ODBC. If I have an Access frontend connected to a SQL Database using ODBC, are the tables connected like a frontend/backend Access database where the the tables you see...
1
by: MostBanyest | last post by:
i am not good in programming and i need help i wrote a program in VB6 that uses MS access database, its supposed to save records into a temporary database, when you are happy with the records it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.