我使用下面的代码在我的应用程序中使用 Timmer 更新 datagridview。Timmer 每秒运行一次,并保持屏幕闪烁。我怎样才能改变不闪烁的时间?或另一种更新datagridview的方法?
SqlConnection mySqlConnection = new SqlConnection(SQLCONN);
mySqlConnection.Open();
SqlDataAdapter addapter = new SqlDataAdapter();
DataTable dt = new DataTable("SSReportAmalgamate");
SqlCommand cmd = mySqlConnection.CreateCommand();
cmd.CommandText = "EXEC App_GetDATA " + "@acc" + "," + "@selecttype";
cmd.Parameters.Add("@acc", SqlDbType.Char).Value = acc;
cmd.Parameters.Add("@selecttype", SqlDbType.Char).Value = type;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandType = CommandType.Text;
cmd.Connection = mySqlConnection;
addapter.SelectCommand = cmd;
addapter.Fill(dt);
dataGridView1.DataSource = dt;
mySqlConnection.Close();