...
timer1.Start();
...private void timer1_Tick(object sender, System.EventArgs e)
{
timer1.Stop();
try
{...
SqlConnection conn=new SqlConnection("...");
conn.Open();
...
conn.Close();
textBox1.Text="ok";
}
catch
{
textBox1.Text="erro";
}
timer1.Start();
}运行时现象很怪,我将网络断开后运行程序显示“erro”,再将网线接上显示“ok”,但是如果先不断开网线运行程序,显示“ok”,即使断开后也一直显示“ok”。怎么回事!请指教。
timer1.Start();
...private void timer1_Tick(object sender, System.EventArgs e)
{
timer1.Stop();
try
{...
SqlConnection conn=new SqlConnection("...");
conn.Open();
...
conn.Close();
textBox1.Text="ok";
}
catch
{
textBox1.Text="erro";
}
timer1.Start();
}运行时现象很怪,我将网络断开后运行程序显示“erro”,再将网线接上显示“ok”,但是如果先不断开网线运行程序,显示“ok”,即使断开后也一直显示“ok”。怎么回事!请指教。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货