473,394 Members | 1,746 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,394 software developers and data experts.

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
StackOverFlowException 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 btnUpdateDatabase_Click(object sender, System.EventArgs
e)
{
try
{
if (catalogsDS.HasChanges())
{
DataSet xDs;
xDs = catalogsDS.GetChanges(); //**********
if (!xDs.HasErrors)
{
da = DataAdapters.CatalogsAdapter();
da.Update(xDs);
UpdateStatusBar("The database has been successfully updated!");
}
}
}
catch (System.StackOverflowException st)
{
MessageBox.Show(st.Message + "\n" + st.StackTrace);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
}
}
Nov 15 '05 #1
6 2459
Babu Mannaravalappil <ba*****@optonline.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
StackOverFlowException 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.com>
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*****@optonline.net> wrote in message
news:35**************************@posting.google.c om...
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
StackOverFlowException 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 btnUpdateDatabase_Click(object sender, System.EventArgs
e)
{
try
{
if (catalogsDS.HasChanges())
{
DataSet xDs;
xDs = catalogsDS.GetChanges(); //**********
if (!xDs.HasErrors)
{
da = DataAdapters.CatalogsAdapter();
da.Update(xDs);
UpdateStatusBar("The database has been successfully updated!");
}
}
}
catch (System.StackOverflowException st)
{
MessageBox.Show(st.Message + "\n" + st.StackTrace);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
}
}

Nov 15 '05 #3
Babu Mannaravalappil <ba*****@optonline.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.com>
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.update(dataset), if I call like
dataadapter.update(dataset.table1);
dataadapter.update(dataset.table2);....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*****@optonline.net> wrote in message
news:35**************************@posting.google.c om...
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
StackOverFlowException 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 btnUpdateDatabase_Click(object sender, System.EventArgs
e)
{
try
{
if (catalogsDS.HasChanges())
{
DataSet xDs;
xDs = catalogsDS.GetChanges(); //**********
if (!xDs.HasErrors)
{
da = DataAdapters.CatalogsAdapter();
da.Update(xDs);
UpdateStatusBar("The database has been successfully updated!");
}
}
}
catch (System.StackOverflowException st)
{
MessageBox.Show(st.Message + "\n" + st.StackTrace);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
}
}

Nov 15 '05 #5
Babu Mannaravalappil <ba*****@optonline.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.update(dataset), if I call like
dataadapter.update(dataset.table1);
dataadapter.update(dataset.table2);....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.com>
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.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Babu Mannaravalappil <ba*****@optonline.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.update(dataset), if I call like
dataadapter.update(dataset.table1);
dataadapter.update(dataset.table2);....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.com>
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
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...
5
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...
4
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...
1
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...
0
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...
15
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...
5
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...
3
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...
1
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...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.