【C#】记录程序耗时方法

2021-07-15 09:13

阅读:452

stopwatch.Start();
using (IDbConnection conn = DapperService.MySqlConnection())
{
string sqlCommandText = @"INSERT INTO db_topic(question,answer,optionA,optionB,optionC,optionD,optionE,optionF,optionG,optionH,optiontypeid,classid)VALUES(@Question,@Answer,@OptionA,@OptionB,@OptionC,@OptionD,@OptionE,@OptionF,@OptionG,@OptionH,@Type,@ClassId)";
int result = conn.Execute(sqlCommandText, topicrights );
stopwatch.Stop();
Console.WriteLine("成功导入{0}条数据 ,用时{1}秒。",result,stopwatch.Elapsed.TotalSeconds);

}


评论


亲,登录后才可以留言!