472,364 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

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 1140
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
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
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
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
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
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
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
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
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
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
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.