Posted on Leave a comment

c# display SqlCommand statement


public static string cmdToString(SqlCommand cmd)
{
var c = ” “;
var s = cmd.CommandText;
for (int i = 0; i < cmd.Parameters.Count; i++) { s += c + cmd.Parameters[i].ParameterName; s += " = " + cmd.Parameters[i].Value; c = ", "; } return (s); }

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.