473,513 Members | 10,313 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1635
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
1845
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
2402
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
409
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
2081
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
3261
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
3647
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
2495
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
1226
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
3722
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
1586
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
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7373
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,...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5677
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
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.