473,770 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

StackOverFlow Exception while trying to update the dataset back to the database.

Can somebody please help me figure out why the following method
exceptions out?
Execution at the line marked with ********** hangs for about 15
seconds and then I get an error that says an Unhandled
StackOverFlowEx ception occurred. The execution does not even get
passed to the catch block. At the time of my test, only one of 12
tables in the dataset (catalogsDS) really has changes. The dataset is
not a huge one. Most tables have less than 15 rows and 5 to 10
columns each.

Here is my Dev environment, just in case.
XP Pro (including all the latest patches) on P4 with 1GB RAM
VS.NET 2003 Ent. Arch. with .NET 1.1
Sql Server 2000 Local database.

private void btnUpdateDataba se_Click(object sender, System.EventArg s
e)
{
try
{
if (catalogsDS.Has Changes())
{
DataSet xDs;
xDs = catalogsDS.GetC hanges(); //**********
if (!xDs.HasErrors )
{
da = DataAdapters.Ca talogsAdapter() ;
da.Update(xDs);
UpdateStatusBar ("The database has been successfully updated!");
}
}
}
catch (System.StackOv erflowException st)
{
MessageBox.Show (st.Message + "\n" + st.StackTrace);
}
catch (System.Excepti on ex)
{
MessageBox.Show (ex.Message + "\n" + ex.StackTrace);
}
}
Nov 15 '05 #1
6 2503
Babu Mannaravalappil <ba*****@optonl ine.net> wrote:
Can somebody please help me figure out why the following method
exceptions out?
Execution at the line marked with ********** hangs for about 15
seconds and then I get an error that says an Unhandled
StackOverFlowEx ception occurred. The execution does not even get
passed to the catch block. At the time of my test, only one of 12
tables in the dataset (catalogsDS) really has changes. The dataset is
not a huge one. Most tables have less than 15 rows and 5 to 10
columns each.


Do you have a short but complete example which demonstrates the
problem?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
I am afraid I don't have a short version of the code. I may have to do a
lot of work to make it short enough but still a working module. The whole
flow is tied up with a user interface with a few tabbed pages. All the
pages interact with each other based on the current node on a tree.
Something like Windows explorer. But the right hand pane has a few tabbed
pages. Nothing fancy. All the controls are normal controls like text boxes
and combo boxes. The underlying dataset is a typed dataset that was created
through the dataset schema designer and each table filled by
SqlDataAdapters .

Does that help?

Babu.
"Babu Mannaravalappil " <ba*****@optonl ine.net> wrote in message
news:35******** *************** ***@posting.goo gle.com...
Can somebody please help me figure out why the following method
exceptions out?
Execution at the line marked with ********** hangs for about 15
seconds and then I get an error that says an Unhandled
StackOverFlowEx ception occurred. The execution does not even get
passed to the catch block. At the time of my test, only one of 12
tables in the dataset (catalogsDS) really has changes. The dataset is
not a huge one. Most tables have less than 15 rows and 5 to 10
columns each.

Here is my Dev environment, just in case.
XP Pro (including all the latest patches) on P4 with 1GB RAM
VS.NET 2003 Ent. Arch. with .NET 1.1
Sql Server 2000 Local database.

private void btnUpdateDataba se_Click(object sender, System.EventArg s
e)
{
try
{
if (catalogsDS.Has Changes())
{
DataSet xDs;
xDs = catalogsDS.GetC hanges(); //**********
if (!xDs.HasErrors )
{
da = DataAdapters.Ca talogsAdapter() ;
da.Update(xDs);
UpdateStatusBar ("The database has been successfully updated!");
}
}
}
catch (System.StackOv erflowException st)
{
MessageBox.Show (st.Message + "\n" + st.StackTrace);
}
catch (System.Excepti on ex)
{
MessageBox.Show (ex.Message + "\n" + ex.StackTrace);
}
}

Nov 15 '05 #3
Babu Mannaravalappil <ba*****@optonl ine.net> wrote:
I am afraid I don't have a short version of the code. I may have to do a
lot of work to make it short enough but still a working module. The whole
flow is tied up with a user interface with a few tabbed pages.
You shouldn't need any GUI at all, unless you've got GUI events tied up
in the code which is executed at that point.
All the
pages interact with each other based on the current node on a tree.
Something like Windows explorer. But the right hand pane has a few tabbed
pages. Nothing fancy. All the controls are normal controls like text boxes
and combo boxes. The underlying dataset is a typed dataset that was created
through the dataset schema designer and each table filled by
SqlDataAdapters .

Does that help?


I suspect it's nothing to do with the controls - I would imagine it's
something like an OnRowChanged (or whatever) event handler which is
calling itself.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #4
I just found out that if I do the database update one table at time rather
than the whole dataset, in other words, instead of calling like
dataadapter.upd ate(dataset), if I call like
dataadapter.upd ate(dataset.tab le1);
dataadapter.upd ate(dataset.tab le2);....etc., it seems to work fine. No more
stack overflow. But I was trying to avoid calling update methods
separately. I assume separate calls to update each table makes those many
trips to the database server. Whereas (this is just my assumption), if I
call the update on the dataset on the whole, it only makes one trip to the
database. Am I assuming correctly?

Babu.

"Babu Mannaravalappil " <ba*****@optonl ine.net> wrote in message
news:35******** *************** ***@posting.goo gle.com...
Can somebody please help me figure out why the following method
exceptions out?
Execution at the line marked with ********** hangs for about 15
seconds and then I get an error that says an Unhandled
StackOverFlowEx ception occurred. The execution does not even get
passed to the catch block. At the time of my test, only one of 12
tables in the dataset (catalogsDS) really has changes. The dataset is
not a huge one. Most tables have less than 15 rows and 5 to 10
columns each.

Here is my Dev environment, just in case.
XP Pro (including all the latest patches) on P4 with 1GB RAM
VS.NET 2003 Ent. Arch. with .NET 1.1
Sql Server 2000 Local database.

private void btnUpdateDataba se_Click(object sender, System.EventArg s
e)
{
try
{
if (catalogsDS.Has Changes())
{
DataSet xDs;
xDs = catalogsDS.GetC hanges(); //**********
if (!xDs.HasErrors )
{
da = DataAdapters.Ca talogsAdapter() ;
da.Update(xDs);
UpdateStatusBar ("The database has been successfully updated!");
}
}
}
catch (System.StackOv erflowException st)
{
MessageBox.Show (st.Message + "\n" + st.StackTrace);
}
catch (System.Excepti on ex)
{
MessageBox.Show (ex.Message + "\n" + ex.StackTrace);
}
}

Nov 15 '05 #5
Babu Mannaravalappil <ba*****@optonl ine.net> wrote:
I just found out that if I do the database update one table at time rather
than the whole dataset, in other words, instead of calling like
dataadapter.upd ate(dataset), if I call like
dataadapter.upd ate(dataset.tab le1);
dataadapter.upd ate(dataset.tab le2);....etc., it seems to work fine. No more
stack overflow. But I was trying to avoid calling update methods
separately. I assume separate calls to update each table makes those many
trips to the database server. Whereas (this is just my assumption), if I
call the update on the dataset on the whole, it only makes one trip to the
database. Am I assuming correctly?


No - there's no particular difference between updating a dataset as a
whole and updating each table individually, as far as the database
connection is concerned. Bear in mind that the data adapter doesn't put
everything into a single transaction or anything like that - it just
goes through each changed row and executes the appropriate command.

However, I would look closely at what's happening to give you the
difference in behaviour here...

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #6
Thanks Jon.

Babu.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Babu Mannaravalappil <ba*****@optonl ine.net> wrote:
I just found out that if I do the database update one table at time rather than the whole dataset, in other words, instead of calling like
dataadapter.upd ate(dataset), if I call like
dataadapter.upd ate(dataset.tab le1);
dataadapter.upd ate(dataset.tab le2);....etc., it seems to work fine. No more stack overflow. But I was trying to avoid calling update methods
separately. I assume separate calls to update each table makes those many trips to the database server. Whereas (this is just my assumption), if I call the update on the dataset on the whole, it only makes one trip to the database. Am I assuming correctly?


No - there's no particular difference between updating a dataset as a
whole and updating each table individually, as far as the database
connection is concerned. Bear in mind that the data adapter doesn't put
everything into a single transaction or anything like that - it just
goes through each changed row and executes the appropriate command.

However, I would look closely at what's happening to give you the
difference in behaviour here...

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #7

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

Similar topics

1
291
by: Chris | last post by:
Hi, I have a DB-table 'AirplaneTypes' that has to 2 fields that form the primary key : 'at_name' and 'at_model' both in the DB defined as type : char 15 MyWinform client : void Form_Load(...) {
5
2384
by: Steve B. | last post by:
A particular column in my Access DB table, and the associated datagrid, cannot have duplicate string entries. I've selected "Yes (no duplicates)" for the Indexed Field Property of this column in the Access table. When I call update(), the DB gets updated but throws an exception saying, in affect, that I'm trying to change the key. This column is not the key. How do I handle this? How do I stop the ex.message being thrown? I guess I...
4
1443
by: Frank Rizzo | last post by:
Hello. Every now and then (it's rare), i get an exception when calling SqlDataAdapter.Fill. The code is calling a stored procedure and attempts to stuff the results into a dataset. It yields the following exception. I am trying to understand what the exception is actually complaining about. Is it a problem with the data that came back or is it an issue inside the stored procedure? Any alternative ways to nail down this issue would...
1
2919
by: Henry | last post by:
Hi. I've been trying to modify my dataset and have been unsucessful. Any help would be great. What I have is a dataset in a session variable. Here is what I have done to stored into the dataset via store procedure. Sample Stored Procedure: CREATE PROCEDURE prcGetData AS
0
5676
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet) at TryThis.Form1.save() in C:\Documents and Settings\Nick\My Documents\...
15
2255
by: David | last post by:
Hi, I have built a web application that will be a very high profile application. We had tested it, demonstrated it and shown that it all works. On a dress rehearsal run through, it failed spectacularly. I was so embarrassed and felt like killing the person that made it fail. However, when it goes live, IT MUST NOT FAIL. The system has a backoffice system that takes an excel spreadsheet from the
5
4915
by: Gene Ariani | last post by:
Is there a limit to how big a rowfilter on dataview could be? my rowfilter is dynamically generated and if its get too big I get a stackoverflow error other wise it works fine. Any direction is appreciated it.
3
2415
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent table. However I put some code in to display the key field of each parent table record (parent dataset) and the value I am trying to put into the child table is there. ParentTable ChildTable ID------------------------<...
1
1982
by: metsys | last post by:
We have an ASP.NET 2.0 (C#) application that is divided into multiple layers. The multiple layers come from having a web project and 2 different class library projects in the same solution. I'm having difficulties figuring out the best way to handle (catch) exceptions in the different layers and then propagating those errors back up through the call stack to ultimately display something to the end-user. Note this is an intranet...
0
9618
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
9454
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,...
0
10101
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9906
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...
1
7456
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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 we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.