473,498 Members | 703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using GetChanges without DataAdapter

6 New Member
Documentation on GetChanges say the following: Gets a copy of the DataSet that contains all changes made to it since it was loaded or AcceptChanges was last called.

Does this mean I can update via a stored procedure and getchanges will know, or do I need to do this update using a DataAdapter. Currently, I'm not getting any rows with GetChanges, but I'm a new programmer and it may be something entirely unrelated.

I update my data like this:

Dim UpdateVouchersCommand As New SqlCommand("spManageVouchers", Connection)
UpdateVouchersCommand.CommandType = CommandType.StoredProcedure
UpdateVouchersCommand.Parameters.AddWithValue("@or gcode", "orgcode")
UpdateVouchersInVouchingListCommand.ExecuteNonQuer y()

I then want to "refresh" the data in my dataset that this stored procedure updated:

DataTable = MyDataSet.Tables("MyTable").GetChanges()

I then use that DataTable to populate a ListView.

For me, using a stored procedure is easier for this particular function. But I'd be happy to hear feedback if this is a really bad way of doing this.

-Daranee
Apr 9 '07 #1
1 1640
daranee
6 New Member
Apologies for responding to my own post. While I haven't really grasped why, I have come up with a work around and who knows this might be helpful to someone else.
Please feel free to correct me if the following information is incorrect.

The Command Builder which uses the DataAdapter to make changes requires a Primary Key in the select statement. In my situation, I was updating quite a few records and in which I could not use a Primary Key. However, I was not violating the PK or any constraints.

I therefore created an SqlCommand with a type of stored procedure. Using this process DataRowState.Modified turned up zero. DataRowState.Unchanged turned up my entire data table.

Therefore to refresh my data I:

MyDataSet.Dispose()
MyDataSet.Relations.Clear()

I then executed the sub routine that added the data in the first place.

I would like to close by saying that I think the MS definition of GetChanges that i cited in my earlier post is misleading.
Apr 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2568
by: Paul | last post by:
I am writing a DataBase Client/Server pair of applications in C#. The client registers a query, the server populates a dataset and its contents sent via XML to be displayed in the client DataGrid....
1
2329
by: Marty | last post by:
In winforms, I can bind a datagrid to a dataset. When the user wants to submit changes, it's easy to see what has changed with the DataSet "GetChanges" method. In ASP.Net, I can create the...
3
37795
by: Ed | last post by:
Hi, I want to load data to a table in Sql Server from a dataset table in my vb.net app using a dataAdapter. I know how to do this as follows (my question is to see if I can reduce the amount...
24
5412
by: Sam | last post by:
Hi, I have a datagrid which source is a dataset : dgFields.Rows.DataMember = m_dsFields.Tables(0).TableName dgFields.Rows.DataSource = m_dsFields Now my values are displayed properly and when...
4
11147
by: George | last post by:
Got a question about the side effect of DataAdapter.Update() and DataTable.GetChanges(). Say I set up a DataTable and a DataAdapter in a class. Delete (Not remove) a row in the data table and...
1
2505
by: matt | last post by:
hello, i have a web app that allows users to query our oracle db and produce a dataset of report data. they then have the option to serialize this data and store it in the database. later, then...
3
2313
by: John Sheppard | last post by:
Hello there, I have the following code; I do this as a work around for a dataset.haschanges method which doesnt appear to work correctly either For Each dt As DataTable In myDs.Tables If Not...
1
1582
by: Tony Johansson | last post by:
Hello! Below is a simple program that works fine. In this program there is no explicit open for the SqlConnection instead the DataAdapter will open the Connection to the database automatically....
0
4722
MrMancunian
by: MrMancunian | last post by:
How to create a database connection without using wizards Introduction I've seen a lot of questions on the net about getting data from, and saving data to databases. Here's a little insight how...
0
7124
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
6998
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
5460
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,...
1
4904
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...
0
4586
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
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
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 ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
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.