473,588 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in Data Set update to database

Hi All,
I am fetching a dataset from the database under some condition. After
this I create a data table. Traverse in the original dataset & add
each row to created data table as it is through LoadDataRow method.
After adding the row I just update 4-5 columns out of 20 columns in
the row. After entire looping I fire the AcceptChanges method on data
table. After this I am trying to update this data back to database in
two ways -
1) Merge the above datatable to the original dataset & update it back
to database through the data adapter. The data adapter I used in one
case was the same with which I filled the original dataset. And in
second case I created a fresh data adapter & tried to update.
2) In another method I just tried to update the created data table as
it is to the database.
I have also created the appropriate commands for the data adapter
through command builder. But unfortunately even after getting no
errors on the Update call of the data adapter there are no records
getting added to the database.
Any kind of pointers are dearly welcome.

Jul 10 '07 #1
6 3793
Did you check the RowState on the affected rows?
Peter

"Suresh" <su************ @gmail.comwrote in message
news:11******** *************@q 75g2000hsh.goog legroups.com...
Hi All,
I am fetching a dataset from the database under some condition. After
this I create a data table. Traverse in the original dataset & add
each row to created data table as it is through LoadDataRow method.
After adding the row I just update 4-5 columns out of 20 columns in
the row. After entire looping I fire the AcceptChanges method on data
table. After this I am trying to update this data back to database in
two ways -
1) Merge the above datatable to the original dataset & update it back
to database through the data adapter. The data adapter I used in one
case was the same with which I filled the original dataset. And in
second case I created a fresh data adapter & tried to update.
2) In another method I just tried to update the created data table as
it is to the database.
I have also created the appropriate commands for the data adapter
through command builder. But unfortunately even after getting no
errors on the Update call of the data adapter there are no records
getting added to the database.
Any kind of pointers are dearly welcome.

Jul 10 '07 #2
On Jul 10, 2:56 pm, "Peter Bradley" <pbrad...@uwic. ac.ukwrote:
Did you check the RowState on the affected rows?

Peter

"Suresh" <sureshmishr... @gmail.comwrote in message

news:11******** *************@q 75g2000hsh.goog legroups.com...
Hi All,
I am fetching a dataset from the database under some condition. After
this I create a data table. Traverse in the original dataset & add
each row to created data table as it is through LoadDataRow method.
After adding the row I just update 4-5 columns out of 20 columns in
the row. After entire looping I fire the AcceptChanges method on data
table. After this I am trying to update this data back to database in
two ways -
1) Merge the above datatable to the original dataset & update it back
to database through the data adapter. The data adapter I used in one
case was the same with which I filled the original dataset. And in
second case I created a fresh data adapter & tried to update.
2) In another method I just tried to update the created data table as
it is to the database.
I have also created the appropriate commands for the data adapter
through command builder. But unfortunately even after getting no
errors on the Update call of the data adapter there are no records
getting added to the database.
Any kind of pointers are dearly welcome.- Hide quoted text -

- Show quoted text -
Thanks Peter for the quick response.
I didn't check the RowState but I did check & found that the rows were
indeed getting added to the merged dataset. But as said not getting
inserted into the database. Please let me know if you need me to check
the RowState & tell you what value I am getting.

Jul 10 '07 #3
"Suresh" <su************ @gmail.comwrote in message
news:11******** **************@ r34g2000hsd.goo glegroups.com.. .
Thanks Peter for the quick response.
I didn't check the RowState but I did check & found that the rows were
indeed getting added to the merged dataset. But as said not getting
inserted into the database. Please let me know if you need me to check
the RowState & tell you what value I am getting.
Does this help:

http://www.knowdotnet.com/articles/datasetmerge.html
Peter
Jul 10 '07 #4
On Jul 10, 4:52 pm, "Peter Bradley" <pbrad...@uwic. ac.ukwrote:
"Suresh" <sureshmishr... @gmail.comwrote in message

news:11******** **************@ r34g2000hsd.goo glegroups.com.. .
Thanks Peter for the quick response.
I didn't check the RowState but I did check & found that the rows were
indeed getting added to the merged dataset. But as said not getting
inserted into the database. Please let me know if you need me to check
the RowState & tell you what value I am getting.

Does this help:

http://www.knowdotnet.com/articles/datasetmerge.html

Peter
It's a little long article so let me have a nice look at it & then I'd
try the same. But by the initial reading it seems that I am doing the
other way round so it probably might work. Would keep you posted on
the updates. But really thanks for this article which says how we work
with DataAdapters is absolutely wrong & opposite to what it should be.

Jul 10 '07 #5
On Jul 10, 5:45 pm, Suresh <sureshmishr... @gmail.comwrote :
On Jul 10, 4:52 pm, "Peter Bradley" <pbrad...@uwic. ac.ukwrote:
"Suresh" <sureshmishr... @gmail.comwrote in message
news:11******** **************@ r34g2000hsd.goo glegroups.com.. .
Thanks Peter for the quick response.
I didn't check the RowState but I did check & found that the rows were
indeed getting added to the merged dataset. But as said not getting
inserted into the database. Please let me know if you need me to check
the RowState & tell you what value I am getting.
Does this help:
http://www.knowdotnet.com/articles/datasetmerge.html
Peter

It's a little long article so let me have a nice look at it & then I'd
try the same. But by the initial reading it seems that I am doing the
other way round so it probably might work. Would keep you posted on
the updates. But really thanks for this article which says how we work
with DataAdapters is absolutely wrong & opposite to what it should be.
Yeah Peter,
It did work. And I just don't know how to thank you. As it has not
just eaten up my days but also made me think that ADO.Net is just not
worth using. I had people around me to help but they also landed with
the same conclusion. So thanks a ton for great help & made me realize
that yes we should not draw conclusions unless we know the thing in
whole. Again, thanks buddy.

Jul 10 '07 #6

"Suresh" <su************ @gmail.comwrote in message
news:11******** **************@ 57g2000hsv.goog legroups.com...
Yeah Peter,
It did work. And I just don't know how to thank you.
No need. Glad it worked.
Peter
Jul 10 '07 #7

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

Similar topics

1
1553
by: Tim | last post by:
Hi all, Here is a brief description of a problem I encountered, and how I found a work around after 3 long days. I have a VB6 app that uses ADO and ODBC to get communicate with SQL server 2000 (sp3, running in win2003). Everything was running great for a few weeks, but one day an update statement that used to work just stopped working. It was a simple update of 1 field in a table (about 30 columns, about 20k records).
14
2251
by: Venkat Chellam | last post by:
I have a peculiar problem. I have a simple web application which loads some data from the oracle table and display in the datagrid in the webpage and datagrid has page enabled which shows 10 rows at a page.I have a search criteria to search the records based on the data range i give This is what i have done, in the !IsPostBack section. I am setting up the oracle connection, creating dataset object, datadapter and i aslo load the data...
5
2020
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
14
2113
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these grid and write to the database and I set the new Primary Keys and related Fields to the new asigned atuonumbers in the Access.
1
2027
by: r2destini | last post by:
Hi Friends, I am new to .Net. So I don't know much. I am facing a problem in updating database through ADO.Net I am creating the dataset and there is no problem in the updation and deletion or insertion in the dataset but when I am updating the
15
1806
by: Scotty | last post by:
I like to have a good insert, update and delete code The code below sometimes workl ok sometimes doesnt work, what i am doing wrong?? Sub SaveAny() Dim command_builder As New OleDb.OleDbCommandBuilder(daOrders) ' Save any changes.
5
2601
by: Brad Baker | last post by:
I'm trying to write a simple asp.net page which updates some data in a SQL database. At the top of the page I have the following code: <%@ Page Language="C#" Debug="true" %> <%@ import namespace="System.Data" %> <%@ import namespace="System.Data.SqlClient" %> <script language="c#" runat="server"> public void Page_Load(object sender, EventArgs e) {
11
6055
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know if that's what's causing the behavior or not. It seems like the Update button should at least do something. When the Edit button is clicked, the grid goes into Edit mode and the Cancel button takes the grid out of Edit mode. So, I don't get what...
2
2625
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to update the information which is stored in a SQL database. In testing we noticed that the form was updating correctly but the update mechanism was also updating the first record of the table in the sql database every time. No error messages are on...
0
7929
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
7862
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,...
1
7987
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
8223
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
6634
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
5729
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
5398
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
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1459
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.