#if DEBUG
     System.Diagnostics.Debug.WriteLine("※Begin SQL※");
     System.Diagnostics.Debug.WriteLine("sql:" + _command.Data.InnerCommand.CommandText);
     System.Diagnostics.Debug.Write("Parameters:");
     foreach (DbParameter p in _command.Data.InnerCommand.Parameters)
     {
         System.Diagnostics.Debug.WriteLine("{name:(" + p.ParameterName + ") value:" + p.Value + "}");
     }
     System.Diagnostics.Debug.WriteLine("※End SQL※");
#endif

本文转载:CSDN博客