473,503 Members | 3,722 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:

libraryTableAdapter1.Fill(library1._Library);
libraryTableAdapter1.Insert(result, 1, 0, 0, 0, 0, "",
"", "", "", 2000);
libraryTableAdapter1.Update(library1._Library);
library1._Library.AcceptChanges();

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

libraryTableAdapter1 is a TableAdapter
library1 is a DataSet
result is a string

PS: This is in VS2005.
Nov 23 '05 #1
6 1166
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.Update 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.htm
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.Update to write that change back to the
database.

Nov 24 '05 #3
Hi,

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

libraryTableAdapter1.Fill(library1._Library);
libraryTableAdapter1.Insert(result, 1, 0, 0, 0, 0, "",
"", "", "", 2000);
libraryTableAdapter1.Update(library1._Library);
library1._Library.AcceptChanges();

When my program finishes, however, there is nothing new. The row was never
added to the actual db.
It should either be :
libraryTableAdapter1.Fill(library1._Library);
library1._Library.Add_LibraryRow( ... );
libraryTableAdapter1.Update(library1._Library );
- or -
libraryTableAdapter.Insert( ... );

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

HTH,
Greetings


libraryTableAdapter1 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*****@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
What am I missing here? Based on what the help files tell me, it seems
like
my code should look like this:

libraryTableAdapter1.Fill(library1._Library);
libraryTableAdapter1.Insert(result, 1, 0, 0, 0, 0, "",
"", "", "", 2000);
libraryTableAdapter1.Update(library1._Library);
library1._Library.AcceptChanges();

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


It should either be :
libraryTableAdapter1.Fill(library1._Library);
library1._Library.Add_LibraryRow( ... );
libraryTableAdapter1.Update(library1._Library );
- or -
libraryTableAdapter.Insert( ... );

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

HTH,
Greetings


libraryTableAdapter1 is a TableAdapter
library1 is a DataSet
result is a string

PS: This is in VS2005.


Nov 24 '05 #5
Hi,

"mmxbass" <mm*****@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.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 ConnectionString and
change "|DataDirectory|\yourdb.mdb" into "..\..\yourdb.mdb". 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*****@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
> What am I missing here? Based on what the help files tell me, it seems
> like
> my code should look like this:
>
> libraryTableAdapter1.Fill(library1._Library);
> libraryTableAdapter1.Insert(result, 1, 0, 0, 0, 0,
> "",
> "", "", "", 2000);
> libraryTableAdapter1.Update(library1._Library);
> library1._Library.AcceptChanges();
>
> When my program finishes, however, there is nothing new. The row was
> never
> added to the actual db.


It should either be :
libraryTableAdapter1.Fill(library1._Library);
library1._Library.Add_LibraryRow( ... );
libraryTableAdapter1.Update(library1._Library );
- or -
libraryTableAdapter.Insert( ... );

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

HTH,
Greetings

>
> libraryTableAdapter1 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*****@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.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 ConnectionString and
change "|DataDirectory|\yourdb.mdb" into "..\..\yourdb.mdb". 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*****@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
> What am I missing here? Based on what the help files tell me, it seems
> like
> my code should look like this:
>
> libraryTableAdapter1.Fill(library1._Library);
> libraryTableAdapter1.Insert(result, 1, 0, 0, 0, 0,
> "",
> "", "", "", 2000);
> libraryTableAdapter1.Update(library1._Library);
> library1._Library.AcceptChanges();
>
> When my program finishes, however, there is nothing new. The row was
> never
> added to the actual db.

It should either be :
libraryTableAdapter1.Fill(library1._Library);
library1._Library.Add_LibraryRow( ... );
libraryTableAdapter1.Update(library1._Library );
- or -
libraryTableAdapter.Insert( ... );

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

HTH,
Greetings


>
> libraryTableAdapter1 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
1476
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. ...
4
5334
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. ...
9
3183
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...
6
1721
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...
16
1765
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...
0
952
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...
30
3353
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...
5
5163
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...
11
4113
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...
0
7192
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
7064
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...
0
7315
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...
0
5559
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
4665
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...
0
3158
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
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
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.