473,395 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 3777
Did you check the RowState on the affected rows?
Peter

"Suresh" <su************@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.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*********************@q75g2000hsh.googlegro ups.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.googlegr oups.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.googlegr oups.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.googlegr oups.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.googlegro ups.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
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...
14
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...
5
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...
14
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...
1
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...
15
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...
5
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...
11
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...
2
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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,...
0
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
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...

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.