SqlCommand command = new SqlCommand("select * from customers", conn); command.ExecuteNonQuery(); command.Dispose(); Thread.Sleep(5000); //模擬耗時(shí)的查詢 conn.Close(); Console.WriteLine("Thread:{0} 執(zhí)行完畢,{1}", Thread.CurrentThread.Name, DateTime.Now); } 代碼很簡(jiǎn)單,模擬兩個(gè)線程同時(shí)執(zhí)行Ex...
www.dbjr.com.cn/article/367...htm 2025-5-30