public static void TraceSqlCommand(SqlCommand command, bool isStarting)
        {
            if (((isStarting && TD.StartSqlCommandExecuteIsEnabled()) ||
                 (!isStarting && TD.EndSqlCommandExecuteIsEnabled())) && command != null)
            {
                StringBuilder traceString = new StringBuilder(SqlWorkflowInstanceStoreConstants.DefaultStringBuilderCapacity);
                bool          firstItem   = false;

                foreach (SqlParameter sqlParameter in command.Parameters)
                {
                    string value;
                    if ((sqlParameter.Value == DBNull.Value) || (sqlParameter.Value == null))
                    {
                        value = "Null";
                    }
                    else if (sqlParameter.DbType == System.Data.DbType.Binary)
                    {
                        value = "Binary";
                    }
                    else
                    {
                        value = sqlParameter.Value.ToString();
                    }

                    if (firstItem)
                    {
                        traceString.AppendFormat(CultureInfo.InvariantCulture, "{0}='{1}'", sqlParameter.ParameterName, value);
                        firstItem = false;
                    }
                    else
                    {
                        traceString.AppendFormat(CultureInfo.InvariantCulture, ", {0}='{1}'", sqlParameter.ParameterName, value);
                    }

                    traceString.AppendLine(command.CommandText);
                }

                if (isStarting)
                {
                    TD.StartSqlCommandExecute(traceString.ToString());
                }
                else
                {
                    TD.EndSqlCommandExecute(traceString.ToString());
                }
            }
        }
 public static void TraceSqlCommand(SqlCommand command, bool isStarting)
 {
     if ((isStarting && TD.StartSqlCommandExecuteIsEnabled()) || (!isStarting && TD.EndSqlCommandExecuteIsEnabled()))
     {
         StringBuilder builder = new StringBuilder(0x200);
         bool          flag    = false;
         foreach (SqlParameter parameter in command.Parameters)
         {
             string str;
             if ((parameter.Value == DBNull.Value) || (parameter.Value == null))
             {
                 str = "Null";
             }
             else if (parameter.DbType == DbType.Binary)
             {
                 str = "Binary";
             }
             else
             {
                 str = parameter.Value.ToString();
             }
             if (flag)
             {
                 builder.AppendFormat(CultureInfo.InvariantCulture, "{0}='{1}'", new object[] { parameter.ParameterName, str });
                 flag = false;
             }
             else
             {
                 builder.AppendFormat(CultureInfo.InvariantCulture, ", {0}='{1}'", new object[] { parameter.ParameterName, str });
             }
             builder.AppendLine(command.CommandText);
         }
         if (isStarting)
         {
             TD.StartSqlCommandExecute(builder.ToString());
         }
         else
         {
             TD.EndSqlCommandExecute(builder.ToString());
         }
     }
 }