473,499 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert into MS-Access table does not work

Hi all

I don't understand why the following sample won't work.

I added a tableadapter with drag and drop from the datasource which is a
MS-Access DB and try to insert a record. The record is in the dataset
but never gets inserted in the access db.
Me.Tabelle1TableAdapter.Fill(Me.Db6DataSet.Tabelle 1)
Dim drnew As DataRow
drnew = Db6DataSet.Tabelle1.NewRow
drnew("Testfeld") = "MyTestStringToInsert"
Db6DataSet.Tabelle1.Rows.Add(drnew)
Tabelle1TableAdapter.Update(Db6DataSet.Tabelle1)
Regards

Manfred

Mar 25 '06 #1
1 1414

Manfred wrote:
Hi all

I don't understand why the following sample won't work.

I added a tableadapter with drag and drop from the datasource which is a
MS-Access DB and try to insert a record. The record is in the dataset
but never gets inserted in the access db.
Me.Tabelle1TableAdapter.Fill(Me.Db6DataSet.Tabelle 1)
Dim drnew As DataRow
drnew = Db6DataSet.Tabelle1.NewRow
drnew("Testfeld") = "MyTestStringToInsert"
Db6DataSet.Tabelle1.Rows.Add(drnew)
Tabelle1TableAdapter.Update(Db6DataSet.Tabelle1)
Regards

Manfred ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hello Manfred,my name is Eswar and i am working as a programmer in
dotnet.
Add a 'CommandBuilder' object of connection type you have used. As
dim cb as new OledbCommandBuilder(Me.Tabelle1TableAdapter) and

Try this code.
Me.Tabelle1TableAdapter.Fill(Me.Db6DataSet.Tabelle 1)
Dim drnew As DataRow
drnew = Db6DataSet.Tabelle1.NewRow
drnew("Testfeld") = "MyTestStringToInsert"
Db6DataSet.Tabelle1.Rows.Add(drnew)
Me.Tabelel1TableAdapter.InsertCommand=cb.GetInsert Command() ( I added this line)
Tabelle1TableAdapter.Update(Db6DataSet.Tabelle1)


Note: After doing any modification you have to get the command of that
type by using CommandBuilder object and then call the "Update()"
command of table adapter.
Have a nice day

Mar 25 '06 #2

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

Similar topics

1
37517
by: George Hill | last post by:
Hi I am trying to import several master detail records from files to ms sql server. I have orders file and order_items file that has several rows for each order. If I insert programmatically...
2
3882
by: Justin Rich | last post by:
My details view is in insert mode and my dataset is empty but the details view doesnt show.. not sure how to toss this at MS but i think they should code that if its in insert mode the empty...
8
2537
by: Josué Maldonado | last post by:
Hello List, I'm importing some data from Foxpro to Postgres, there is atable wich contains aprox 4.8 million rows and it size about 830MB. I uploaded it to Postgres using dbf2pg and worked fine,...
5
6597
by: eisenstein | last post by:
i read out an utf-8 xml file with greek or russian/cyrillic characters. i can display it in the browser but if i insert data into an mssql database -field is nvarchar(4000)- i only see ??? or...
1
5524
by: sandraboy07 | last post by:
Hi, anyone. I have a problem with code php. I have image store in MS SQL Server and now i have a web code with php and i use MS SQL Server as datastore. I want to retrieve my image from DB or...
3
2160
by: ahmurad | last post by:
Dear brothers, I have some importnat files in MS Excell / CSV format. I know php. I want to insert these files into MYSQL database to generate reports. What are the techniques to insert the ...
1
2158
by: ahmurad | last post by:
Dear brothers, I have some importnat files in MS Excell / CSV format. I know php. I want to insert these files into MYSQL database to generate reports. What are the techniques to insert the MS...
1
3135
by: Pedro Rosas Silva | last post by:
Hi everyone, Is anybody aware of a way how to insert an image in a WordML document programmatically, through C#? I have a C# application that loads into memory a WordML document...
0
1395
by: getpunith | last post by:
Hi all, How can export or insert an Image to MS WORD 2007. Doc.InlineShapes.AddPicture() needs an Image file stored on disk space, But I dont have Image file.What I have is an Image object. ...
0
968
by: sajjadlove | last post by:
hi, i'm working with sqlserver2000.i want to insert a picture in database.following code used in my project but have an error: using (SqlConnection con = new...
0
7134
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
7180
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
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6901
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
5479
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
3105
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
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
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 ...
0
307
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.