While using stored procedures, we need to pass SQL parameteres to those stored procedures. When there are large numbers of parameters then it is become boring task or tedious job to debug and check what values passed with.
Here I have created a function that will check the values passed to the Stored procedures.
Just pass SQL command to to this function.
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 void SPValues(SqlCommand sqlCmd)
{
string myStr1=String.Empty;
string myStr2=String.Empty;
SqlParameter prm;
foreach(prm in sqlCmd.Parameters)
{
myStr1 += "'" + param.Value + "',";
smyStr2 += "<br>" + param.ParameterName & "=" + param.Value;
System.Web.HttpContext.Current.Response.Write("EXEC " + SQLCMD.CommandText + " " + myStr1);
System.Web.HttpContext.Current.Response.Write(myStr1);
}
}