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

Weird Debugging issue


I have a collection of objects that I'm using to keep track of general
ledger (GL) entires. Each object in the collection is one GL entry. I then
have a function that will add up all the debits and credits (positives and
negatives) entries to make sure they all balance.

To do this, I create a temporary table in SQL server, then insert the values
of each object into the table, and then do a summary of the debit and credit
columns. If the debit & credit columns match, the transaction is valid.

So, this routine works perfectly EXCEPT for when I'm trying to debug it in
VS. When I step through the code, when the code performs the Insert into
table, it inserts the value 4 to 6 times....even though the code only
executes one time. The code is simple: I open the connection, perform the
insert, and close the connection.

Why when I'm stepping through, does it do this?

Additional Notes:
- It doesn't matter if I'm inserting into a temp or a regular table.
- I have an identiy field in the table, so you can actually see it increase
for each record that was entered...even though the code only stepping
through once!

Thanks

-Rob T.
Nov 21 '05 #1
2 820
Without examining the code, I can only guess.

If you are SQL Server, you can switch to XML to enter values. If not, you
can use a DataSet and have the DataAdapter update the insert table (not as
easy with a true temp table). Both avoid individual inserts.

If you move to stored procedures, you have the option of stepping through
sproc code, which may be a better option, but this is far easier in Visual
Studio 2005, which is not released until Nov 7.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Rob T" wrote:

I have a collection of objects that I'm using to keep track of general
ledger (GL) entires. Each object in the collection is one GL entry. I then
have a function that will add up all the debits and credits (positives and
negatives) entries to make sure they all balance.

To do this, I create a temporary table in SQL server, then insert the values
of each object into the table, and then do a summary of the debit and credit
columns. If the debit & credit columns match, the transaction is valid.

So, this routine works perfectly EXCEPT for when I'm trying to debug it in
VS. When I step through the code, when the code performs the Insert into
table, it inserts the value 4 to 6 times....even though the code only
executes one time. The code is simple: I open the connection, perform the
insert, and close the connection.

Why when I'm stepping through, does it do this?

Additional Notes:
- It doesn't matter if I'm inserting into a temp or a regular table.
- I have an identiy field in the table, so you can actually see it increase
for each record that was entered...even though the code only stepping
through once!

Thanks

-Rob T.

Nov 21 '05 #2
Please post your code, and make special note of any variables you may be
changing when debug.

When you are stepping through the code, is the code actually calling the
insert multiple times, or is it calling the insert once and SQL Server is
duplicating the rows?

Also, are you using a SQL insert statement or calling a stored procedure?

Do you have any triggers on the table/tables that you are updating?

Include the code for the stored proc and the triggers if you have any.

"Rob T" <RT*********@DONTwalchemSPAM.com> wrote in message
news:eN**************@TK2MSFTNGP12.phx.gbl...

I have a collection of objects that I'm using to keep track of general
ledger (GL) entires. Each object in the collection is one GL entry. I then have a function that will add up all the debits and credits (positives and
negatives) entries to make sure they all balance.

To do this, I create a temporary table in SQL server, then insert the values of each object into the table, and then do a summary of the debit and credit columns. If the debit & credit columns match, the transaction is valid.

So, this routine works perfectly EXCEPT for when I'm trying to debug it in
VS. When I step through the code, when the code performs the Insert into
table, it inserts the value 4 to 6 times....even though the code only
executes one time. The code is simple: I open the connection, perform the insert, and close the connection.

Why when I'm stepping through, does it do this?

Additional Notes:
- It doesn't matter if I'm inserting into a temp or a regular table.
- I have an identiy field in the table, so you can actually see it increase for each record that was entered...even though the code only stepping
through once!

Thanks

-Rob T.

Nov 21 '05 #3

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

Similar topics

5
by: NanQuan | last post by:
I'm hoping someone can help me solve this error since I am at a total loss here. Usually I don't bother posting on any forums or groups on the internet and prefer to solve stuff myself but this is...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
6
by: Shivakumar | last post by:
Hi all, Recently i have updated my vs.net 2003 project to vs.net 2005 and i have successfully converted my code and found no problem with all my controls except the one which is the linkbutton. ...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
3
by: Herb | last post by:
while trying to run this project. I recently loaded VS2005 onto my WinXP Pro computer. Prior to that I was able to start my VS2003 ASP.NET apps in debug mode. When I attempt to do so now, I get...
7
by: | last post by:
I'm writing an ASP.NET app, using Visual Studio 2003. VS is running locally on my laptop, but the web app is running on a remote server. My laptop is not in the domain. I do have a domain account....
0
by: P Pulkkinen | last post by:
Dear all, sorry, i know this code is far little too long to debug here, but there is really annoying logical error. If someone debugs this, I really offer warm virtual handshake. What this...
3
by: Rick | last post by:
We have a web site that was built as an ASP.Net Web Site, I am unable to remote debug, when build ing the web site there is not a dll or PDB file generated. I can debug on my local machine but...
7
by: Mesan | last post by:
This is baffling me - I'm coming here in a desperate plea that someone smarter than myself (which isn't hard) might be able to explain what's going on. I've got a native C++ console app that has...
7
by: GaryDean | last post by:
(this was also posted on the MSDN WCF forum but the answers over there are not so good) I have a WCF Library hosted by IIS 6 and it all works fine. However I need to step through the code in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.