473,465 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Stepping through Code in ASP.NET

Hi,

I get an error "System.Data.SqlClient.SqlException", 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 1105
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.Errors(i).Server & ": " &
ex.Errors(i).Procedure & ": Error Number" & _
ex.Errors(i).Number.ToString())
sb.Append("Line Number " &
ex.Errors(i).LineNumber.ToString() & vbCrLf)
sb.Append(ex.Errors(i).Message)
If Not IsNothing(ex.InnerException) Then
sb.Append("Inner Exception: " &
ex.InnerException.GetType().ToString() & vbCrLf)
sb.Append(ex.InnerException.Message)
End If
Next
Return sb.ToString()
Catch e As Exception
Utilities.HandleError(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********@hotmail.com> wrote in message
news:uC**************@TK2MSFTNGP14.phx.gbl...
Hi,

I get an error "System.Data.SqlClient.SqlException", 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.SqlClient.SqlException", 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
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...
2
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...
5
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...
0
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...
25
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 ...
0
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...
5
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...
0
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)"...
7
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...
15
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...
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,...
1
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...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.