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 700 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:
Web Application Security — How to Minimize Prevalent Risk of Attacks
Vulnerabilities in web applications are now the largest vector of enterprise security attacks.
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
100% Free Subscription until Stock lost.View complete list.
Sponsored by