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 2291 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:
Simply JavaScript - Free 150 Page Preview!
Packed with full-color examples, Simply JavaScript is all you need to start programming in JavaScript the right way.
Simply SQL - Free 111 Page Preview!
Simply SQL is a practical step-by-step guide to writing SQL.
100% Free Subscription until Stock lost.View complete list.
Sponsored by