473,804 Members | 2,455 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.Tabelle1Tabl eAdapter.Fill(M e.Db6DataSet.Ta belle1)
Dim drnew As DataRow
drnew = Db6DataSet.Tabe lle1.NewRow
drnew("Testfeld ") = "MyTestStringTo Insert"
Db6DataSet.Tabe lle1.Rows.Add(d rnew)
Tabelle1TableAd apter.Update(Db 6DataSet.Tabell e1)
Regards

Manfred

Mar 25 '06 #1
1 1430

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.Tabelle1Tabl eAdapter.Fill(M e.Db6DataSet.Ta belle1)
Dim drnew As DataRow
drnew = Db6DataSet.Tabe lle1.NewRow
drnew("Testfeld ") = "MyTestStringTo Insert"
Db6DataSet.Tabe lle1.Rows.Add(d rnew)
Tabelle1TableAd apter.Update(Db 6DataSet.Tabell e1)
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 OledbCommandBui lder(Me.Tabelle 1TableAdapter) and

Try this code.
Me.Tabelle1Tabl eAdapter.Fill(M e.Db6DataSet.Ta belle1)
Dim drnew As DataRow
drnew = Db6DataSet.Tabe lle1.NewRow
drnew("Testfeld ") = "MyTestStringTo Insert"
Db6DataSet.Tabe lle1.Rows.Add(d rnew)
Me.Tabelel1Tabl eAdapter.Insert Command=cb.GetI nsertCommand() ( I added this line)
Tabelle1TableAd apter.Update(Db 6DataSet.Tabell e1)


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
37578
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 these records how can find out which order ID was the last inserted, so that I can attach the subsesquent row items to a proper order.
2
3901
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 dataset doesnt make it invisible..
8
2566
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, it tooks about 10-15 minutes. Now I'm inserting some data from that table to a brand new table in Postgresql, for that I'm doing insert into ... select from. The point is inserting this data from one table to another table in Postgresql took...
5
6623
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 incorrect characters. has anyone expierence with unicode characters and mssql databses?
1
5555
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 insert. Notice: (images are store as binary). Could anyone help me? Sandra
3
2174
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 Excell / CSV files into MySQL? Your kind quick reply is highly appreciated.
1
2170
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 Excell / CSV files into MySQL? Your kind quick reply is highly appreciated.
1
3160
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 (XmlDocument). The document is tagged in certain places so that the C# application can search for those tags (using the System.Xml namepace) and fill
0
1412
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. Image type is Metafile. Whn I tried to copy from Clipboard, it didnt support the metafile. So is there any other method to insert an Image to WORD.
0
988
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 SqlConnection("server=(local);database=pubs;integrated security=true")) { SqlCommand cmd = new SqlCommand("insert into tb (name,val) values (@name,@val)", con); MemoryStream ms = new MemoryStream(); pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat); byte val =...
0
9704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10561
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10318
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2976
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.