C#sql读取大数据 超时时间已到30秒的解决办法


                ////  创建  数据库表
                SqlConnection conn = new SqlConnection(label2.Text);
                conn.Open();
                string sql = "select  id,xsrq,yaoid,pm,cj,gg,sl,xsdj,xsje,zffs,chufang into 销售查询 from xs  Where DateDiff(year, GetDate(), xsrq ) = 0";  ////其中 xsby1 暂时设置为 支付方式  xsby2  设置为订单号
                SqlCommand com = new SqlCommand(sql, conn);

                com.CommandTimeout = 180;  //180秒  设置 读取超时的时间

                com.ExecuteNonQuery();


                conn.Close();


winform代码
桂ICP备16004754号