473,657 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stepping through Code in ASP.NET

Hi,

I get an error "System.Data.Sq lClient.SqlExce ption", after my Stored
Procedure runs and i saw an article for debugging through the Stored
procedure using VS .Net.
http://techrepublic.com.com/5100-10878_11-5161626.html

i dont use the wizard and create and write data access components myself.
The Stored Procedure runs fine in Query Analyser, but I am goofing somewhere
in the code,

so is there a way i can step through the stored procedures and see whether I
am passing values correctly?

I have no idea whether this is the right group to post my question, but I
have anyway. if you feel that I should post it somewhere, please do point me
to an appropriate group to post.

Thanks,
Stephen

Nov 19 '05 #1
2 1118
Hi Stephen,

You're not going to be able to step through the Stored Procedure via your
application debugging, as it is not part of your compiled code. However, you
are, of course, calling the Stored Procedure, and (I would imagine) passing
parameters to it. You have also already established that the Stored
Procedure is not at fault. So, you could certainly step through the code
that prepares the SqlCommand, and see what your code is doing wrong that is
causing the SQL Server to raise an exception. You can use Watches and
QuickWatches to view the values of the various objects being worked with at
any time. In addition, the SqlException class has a number or helpful
members that expose more information about the exception than the Message
alone. Here is a VB.Net Function I wrote that returns most of this
information in a formatted string:

Public Shared Function GetSqlException (ByVal ex As SqlException) As
String
Try
Dim sb As StringBuilder = New StringBuilder(" SqlException:" &
vbCrLf & "Errors:" & vbCrLf)
For i As Integer = 0 To ex.Errors.Count - 1
sb.Append(ex.Er rors(i).Server & ": " &
ex.Errors(i).Pr ocedure & ": Error Number" & _
ex.Errors(i).Nu mber.ToString() )
sb.Append("Line Number " &
ex.Errors(i).Li neNumber.ToStri ng() & vbCrLf)
sb.Append(ex.Er rors(i).Message )
If Not IsNothing(ex.In nerException) Then
sb.Append("Inne r Exception: " &
ex.InnerExcepti on.GetType().To String() & vbCrLf)
sb.Append(ex.In nerException.Me ssage)
End If
Next
Return sb.ToString()
Catch e As Exception
Utilities.Handl eError(e)
Return "Error getting SqlException: " & e.Message
End Try
End Function

Of course you would have to implement your own exception handling for it. I
use my own Handler that writes to the Event Log. How you want to do it is up
to you.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Stephen Noronha" <st********@hot mail.com> wrote in message
news:uC******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

I get an error "System.Data.Sq lClient.SqlExce ption", after my Stored
Procedure runs and i saw an article for debugging through the Stored
procedure using VS .Net.
http://techrepublic.com.com/5100-10878_11-5161626.html

i dont use the wizard and create and write data access components myself.
The Stored Procedure runs fine in Query Analyser, but I am goofing
somewhere
in the code,

so is there a way i can step through the stored procedures and see whether
I
am passing values correctly?

I have no idea whether this is the right group to post my question, but I
have anyway. if you feel that I should post it somewhere, please do point
me
to an appropriate group to post.

Thanks,
Stephen

Nov 19 '05 #2
Stephen Noronha wrote:
Hi,

I get an error "System.Data.Sq lClient.SqlExce ption", after my Stored
Procedure runs and i saw an article for debugging through the Stored
procedure using VS .Net.
http://techrepublic.com.com/5100-10878_11-5161626.html

i dont use the wizard and create and write data access components
myself. The Stored Procedure runs fine in Query Analyser, but I am
goofing somewhere in the code,

so is there a way i can step through the stored procedures and see
whether I am passing values correctly?

I have no idea whether this is the right group to post my question,
but I have anyway. if you feel that I should post it somewhere,
please do point me to an appropriate group to post.

Thanks,
Stephen


Maybe you can use SqlProfiler. That will show exactly what parameters
are used (and their values).

Hans Kesting
Nov 19 '05 #3

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

Similar topics

3
278
by: c# newbie | last post by:
When stepping through code, to find where an error is thrown, the problem is that I have to step threw the statement that causes the error, and if it's in a class that's instantiated from the main program, then I may miss the statement that causes the error. How can I get the debugger to stop right at the statement that causes the error.
2
1593
by: John Black | last post by:
Hi, I wonder if there is any good way in debugging the code not steping into STL code, it is easy to do in normal statement, just click "step over", but when there are some STL type variable on the function argument list, I do not find a way to skip stepping into STL. Any suggestion?
5
368
by: pinaki_m77 | last post by:
Hi, I am trying to debug a C++ program using Microsoft VC++ IDE. The program loads a dynamic link library (dll) and later makes calls to functions inside this dll. I want to step inside the code of this dll. Is that possible to do? Because currently what is happening is, even if I try to step inside the function in the dll (by F11 key), it is stepping over the whole function (like F10 does). How can I step inside the dll code? Am I doing...
0
1059
by: craig | last post by:
When stepping though C# code in Visual Studio, often times a line of code will cause an event handler to be run. However, it appears that the debugger will not automatically step into that event handler. Is there a way to cause it to step into event handlers automatically? Thanks!
25
3996
by: David C | last post by:
I posted this question, and from the replies, I get the impression that I worded my posting very poorly, so let me try this again. While debugging and stepping through this foreach loop foreach(Student s in course.Students) { Console.WriteLine(s.StudentID); }
0
1155
by: stand__sure | last post by:
Stepping into a stored procedure used to be fairly straight-forward, but after following the guidance in all 6 or so of the MSDN pages about enabling debugging of stored procedures in SQL Server 2005 using VS .NET 2005 running on WinXP Pro (SP2) -- I'm still having no luck. Remote debugging works fine. Stepping into a procedure through the IDE (without the calling app running works fine) A quick inspection of the attached processes...
5
3085
by: scl | last post by:
I have an application with a .Net front end that makes calls into a series of VB6 dll's via COm InterOpt. Although everything works quite well, the main issue that I have is regarding the overall debugging workflow. Ideally, I would like to configure my IDE's such that when I am stepping through my .Net code that makes a call to a VB6 dll method, I am able to step into the VB6 IDE to continue the debugging process. Currently, I cannot...
0
1089
by: =?Utf-8?B?TWlrZSBPS0M=?= | last post by:
VB 2003 As I am stepping through code, I want to see a data table in a grid, so I can easily see the data in the data table. Currently I QuickWatch the data table, then I have to add ".rows(0)" after the data table name in QuickWatch Expression field. I then click on ItemArray, and see the first row in an array. If I want to see the next row, I then have to return to the expression field in QuickWatch, replace rows(0) with rows(1). This...
7
1619
by: Lyn | last post by:
Is there a solution to this problem? While stepping through code (F8) it would sometimes be helpful to observe changes occurring on the affected form in the Access window. However, the current form always seems to be behind all of the open forms (including the Database window) and only small bits of it are visible -- depending on the sizes and locations of the various forms on the screen. Is there a way to ensure that the form being...
15
6248
by: postman | last post by:
Any idea why code would work as intended when setting a breakpoint and stepping through it line by line, but won't work correctly at run-time? The code is too much to post, so I hope this summary of the setup will suffice: There are 3 forms: MainForm recordForm (subform on MainForm) dlgForm (pop-up form)
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
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
8613
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
7351
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...
0
5638
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
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
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
1969
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.