AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 How To Debug SQL Parameters in Asp.Net?
Posted by Antony on  11/5/2009 4:58:19 AM 6281 Views
When you are writing stored procedures you may need to send parameters to sql.
Use below function to check, what are the values are passed to debug your code.
Paste it in App_code folder and just pass the sql command with parameter.

Public Shared Sub CheckSPValues(ByVal SQLCMD As SqlCommand)
Dim str As String = ""
Dim str1 As String = ""
Dim param As SqlParameter
For Each param In SQLCMD.Parameters
str = str & "'" & param.Value & "',"
str1 = str1 & "<br>" & param.ParameterName & "=" & param.Value
Next
System.Web.HttpContext.Current.Response.Write("EXEC " & SQLCMD.CommandText & " " & str)
System.Web.HttpContext.Current.Response.Write(str1)
End Sub

Cheers!
Coding Never End.....

Post New Tips/Tricks View all Tips/Tricks

Featured Resources:
Speech Technology Magazine
Speech Technology is recognized worldwide as the leading source of information on speech technology solutions that are changing communications and technology needs of organizations worldwide.
Everything You Know About CSS Is Wrong! - Free 37 Page Preview!
For web designers and developers who want to ensure they're using the very latest, best-practice CSS techniques.
100% Free Subscription until Stock lost.View complete list.
Sponsored by