473,655 Members | 3,056 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Commiting db changes

What am I missing here? Based on what the help files tell me, it seems like
my code should look like this:

libraryTableAda pter1.Fill(libr ary1._Library);
libraryTableAda pter1.Insert(re sult, 1, 0, 0, 0, 0, "",
"", "", "", 2000);
libraryTableAda pter1.Update(li brary1._Library );
library1._Libra ry.AcceptChange s();

When my program finishes, however, there is nothing new. The row was never
added to the actual db.

libraryTableAda pter1 is a TableAdapter
library1 is a DataSet
result is a string

PS: This is in VS2005.
Nov 23 '05 #1
6 1178
Why would you involve the TableAdapter in the Insert operation? I would
think that you would Insert into a particular DataTable within your
DataSet, then call TableAdapter.Up date to write that change back to the
database.

Nov 24 '05 #2
Because that is what
ms-help://MS.MSDNQTR.v80. en/MS.MSDN.v80/MS.VisualStudio .v80.en/dv_raddata/html/012c5924-91f7-4790-b2a6-f51402b7014b.ht m
from the VS2005 help file seems to be telling me to do.

"Bruce Wood" wrote:
Why would you involve the TableAdapter in the Insert operation? I would
think that you would Insert into a particular DataTable within your
DataSet, then call TableAdapter.Up date to write that change back to the
database.

Nov 24 '05 #3
Hi,

"mmxbass" <mm*****@discus sions.microsoft .com> wrote in message
news:58******** *************** ***********@mic rosoft.com...
What am I missing here? Based on what the help files tell me, it seems
like
my code should look like this:

libraryTableAda pter1.Fill(libr ary1._Library);
libraryTableAda pter1.Insert(re sult, 1, 0, 0, 0, 0, "",
"", "", "", 2000);
libraryTableAda pter1.Update(li brary1._Library );
library1._Libra ry.AcceptChange s();

When my program finishes, however, there is nothing new. The row was never
added to the actual db.
It should either be :
libraryTableAda pter1.Fill(libr ary1._Library);
library1._Libra ry.Add_LibraryR ow( ... );
libraryTableAda pter1.Update(li brary1._Library );
- or -
libraryTableAda pter.Insert( ... );

So you shoudln't confuse them. Offcourse it doesn't really explain why
TableAdapter.In sert didn't work. What DB are you using ?

HTH,
Greetings


libraryTableAda pter1 is a TableAdapter
library1 is a DataSet
result is a string

PS: This is in VS2005.

Nov 24 '05 #4
I'm using an MS access table that I brought in to the project with the add
new data source wizard. Reading the DB works a-ok. Writing is the big problem
here. Nothing seems to take.

"Bart Mermuys" wrote:
Hi,

"mmxbass" <mm*****@discus sions.microsoft .com> wrote in message
news:58******** *************** ***********@mic rosoft.com...
What am I missing here? Based on what the help files tell me, it seems
like
my code should look like this:

libraryTableAda pter1.Fill(libr ary1._Library);
libraryTableAda pter1.Insert(re sult, 1, 0, 0, 0, 0, "",
"", "", "", 2000);
libraryTableAda pter1.Update(li brary1._Library );
library1._Libra ry.AcceptChange s();

When my program finishes, however, there is nothing new. The row was never
added to the actual db.


It should either be :
libraryTableAda pter1.Fill(libr ary1._Library);
library1._Libra ry.Add_LibraryR ow( ... );
libraryTableAda pter1.Update(li brary1._Library );
- or -
libraryTableAda pter.Insert( ... );

So you shoudln't confuse them. Offcourse it doesn't really explain why
TableAdapter.In sert didn't work. What DB are you using ?

HTH,
Greetings


libraryTableAda pter1 is a TableAdapter
library1 is a DataSet
result is a string

PS: This is in VS2005.


Nov 24 '05 #5
Hi,

"mmxbass" <mm*****@discus sions.microsoft .com> wrote in message
news:D2******** *************** ***********@mic rosoft.com...
I'm using an MS access table that I brought in to the project with the add
new data source wizard. Reading the DB works a-ok.
If the .mdb is part of the project (visible in solution explorer) then it
will (most likely) be copied to the bin\debug folder when you execute the
application from within vs. The application will use the .mdb in the
bin\debug folder. So the next time your app runs vs overwrites the .mdb and
your previous made changes are lost.

One thing you can do is open App.config file, look for ConnectionStrin g and
change "|DataDirectory |\yourdb.mdb" into "..\..\yourdb.m db". This way it
will directly use the .mdb that is in the project diectory (instead of of a
new copy).
HTH,
Greetings

Writing is the big problem
here. Nothing seems to take.

"Bart Mermuys" wrote:
Hi,

"mmxbass" <mm*****@discus sions.microsoft .com> wrote in message
news:58******** *************** ***********@mic rosoft.com...
> What am I missing here? Based on what the help files tell me, it seems
> like
> my code should look like this:
>
> libraryTableAda pter1.Fill(libr ary1._Library);
> libraryTableAda pter1.Insert(re sult, 1, 0, 0, 0, 0,
> "",
> "", "", "", 2000);
> libraryTableAda pter1.Update(li brary1._Library );
> library1._Libra ry.AcceptChange s();
>
> When my program finishes, however, there is nothing new. The row was
> never
> added to the actual db.


It should either be :
libraryTableAda pter1.Fill(libr ary1._Library);
library1._Libra ry.Add_LibraryR ow( ... );
libraryTableAda pter1.Update(li brary1._Library );
- or -
libraryTableAda pter.Insert( ... );

So you shoudln't confuse them. Offcourse it doesn't really explain why
TableAdapter.In sert didn't work. What DB are you using ?

HTH,
Greetings

>
> libraryTableAda pter1 is a TableAdapter
> library1 is a DataSet
> result is a string
>
> PS: This is in VS2005.


Nov 24 '05 #6
<h1>??!?! 0_o</h1>
I can't belive I didn't notice that. You're totally right. The origional
code actually does work fine. Visual studio just overrides it with the
origional file every time I rerun the program.

Thank you so much.

"Bart Mermuys" wrote:
Hi,

"mmxbass" <mm*****@discus sions.microsoft .com> wrote in message
news:D2******** *************** ***********@mic rosoft.com...
I'm using an MS access table that I brought in to the project with the add
new data source wizard. Reading the DB works a-ok.


If the .mdb is part of the project (visible in solution explorer) then it
will (most likely) be copied to the bin\debug folder when you execute the
application from within vs. The application will use the .mdb in the
bin\debug folder. So the next time your app runs vs overwrites the .mdb and
your previous made changes are lost.

One thing you can do is open App.config file, look for ConnectionStrin g and
change "|DataDirectory |\yourdb.mdb" into "..\..\yourdb.m db". This way it
will directly use the .mdb that is in the project diectory (instead of of a
new copy).
HTH,
Greetings

Writing is the big problem
here. Nothing seems to take.

"Bart Mermuys" wrote:
Hi,

"mmxbass" <mm*****@discus sions.microsoft .com> wrote in message
news:58******** *************** ***********@mic rosoft.com...
> What am I missing here? Based on what the help files tell me, it seems
> like
> my code should look like this:
>
> libraryTableAda pter1.Fill(libr ary1._Library);
> libraryTableAda pter1.Insert(re sult, 1, 0, 0, 0, 0,
> "",
> "", "", "", 2000);
> libraryTableAda pter1.Update(li brary1._Library );
> library1._Libra ry.AcceptChange s();
>
> When my program finishes, however, there is nothing new. The row was
> never
> added to the actual db.

It should either be :
libraryTableAda pter1.Fill(libr ary1._Library);
library1._Libra ry.Add_LibraryR ow( ... );
libraryTableAda pter1.Update(li brary1._Library );
- or -
libraryTableAda pter.Insert( ... );

So you shoudln't confuse them. Offcourse it doesn't really explain why
TableAdapter.In sert didn't work. What DB are you using ?

HTH,
Greetings


>
> libraryTableAda pter1 is a TableAdapter
> library1 is a DataSet
> result is a string
>
> PS: This is in VS2005.


Nov 24 '05 #7

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

Similar topics

0
1487
by: robmcdan | last post by:
Hi, I'm using RegNotifyChangeKeyValue() (via DllImport) to detect changes to registry keys and subkeys. However, in addition to catching changes, I would like to know what the changes were. Any tips? I think that RegNotifyChangeKeyValue is not going to help me. Can I do this (detect changes and enumerate the changes) with WMI? I was able to catch changes to the registry via WQL event queries, but again, I was unable to determine what...
4
5351
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. Currently everything is working. I can find the updated rows/columns by parsing the posted data collection against the DataGrid DataSource. However, when there is a large amount of DataGridItems (rows) the update processing can take a while. ...
9
3198
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My questions are below... "David Good" wrote: > We have a network running both Win2k and Win2k3 webservers and our web sites > reside on a UNC network share that happens to be a Network Appliance NAS.
6
1735
by: lanem | last post by:
I have a page that shows some data in a datagrid. All rows are updateable and then the changes are saved by hitting the "Save Changes" button. It is not a row by row save. All edits are made and then all altered rows are saved at once. It can be big, so I only want to save the ones that have changed. I'm keeping track of the changed rows in ViewState with this code: Protected Sub RowChanged(ByVal sender As System.Object, ByVal e As...
16
1784
by: Richard | last post by:
Hi, I am passing a structure to a subroutine where the passed parameter has been declared as ByVal. However, changes made to the passed variable inside the subroutine flow through to the actual variable that has been passed over, even though with ByVal this should not happen. Has anybody else discovered this or am I doing completely wrong /
0
959
by: guy | last post by:
I have and arraylist bound to a datagrid which on the whole works fine, however if i select a row as soon as I leave the grid i get "Error when commiting row to backing datastore" I cant seem to trap this, and the data in the grid matches that in the arralist I then get "Index was out of range Must be non-negative and less than the size of the collection" stack trace reveals the problem is at System.Collections.Arraylist.get_Item(int32...
30
3384
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and commits it. How does the other user get the updated view without polling for changes? Is there some sort of callback mechanism that can be set up on the dataset or connection? TIA
5
5174
by: vovan | last post by:
I have set of controls (Textboxes, checkboxes etc) along with the Grid on Windows Form. I use BindingSource to populate both Grid and the set of Controls. User selects the record in the grid and all controls are populated with data from the selected row. The grid is going to be read only. Textboxes, checkboxes are going to be read/write. What event and how do I need to use to catch any change in any of the textboxes? I tried to use...
11
4131
by: gyap88 | last post by:
Hello i m using vb 2005 express to do my project. I m suppose to create a datagrid to allow user to make changes to the database. The program display the database in a datagrid where users can juz make changes there. I encountered a problem when user are trying save changes. The following code is executed when the save button is click: Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click ...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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...
1
8497
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
8598
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
7310
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...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
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
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1598
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.