在执行Ado.net SqlDataAdapter 查询超时设置
2015-12-21 11:10
489 查看
在执行Sqlserver查询时报如下错误:
超时时间已到。在操作完成之前超时时间已过或服务器未响应。
修改方法:
using (SqlConnection connection = new SqlConnection(connectionString))
{
DataSet ds = new DataSet();
try
{
connection.Open();
SqlDataAdapter command = new SqlDataAdapter(SQLString, connection);
command.SelectCommand.CommandTimeout = 0; //取消超时默认设置 默认是30s 增加一条设置
command.Fill(ds, "ds");
}
catch (System.Data.SqlClient.SqlException ex)
{
throw new Exception(ex.Message);
}
return ds;
}
超时时间已到。在操作完成之前超时时间已过或服务器未响应。
修改方法:
using (SqlConnection connection = new SqlConnection(connectionString))
{
DataSet ds = new DataSet();
try
{
connection.Open();
SqlDataAdapter command = new SqlDataAdapter(SQLString, connection);
command.SelectCommand.CommandTimeout = 0; //取消超时默认设置 默认是30s 增加一条设置
command.Fill(ds, "ds");
}
catch (System.Data.SqlClient.SqlException ex)
{
throw new Exception(ex.Message);
}
return ds;
}
相关文章推荐
- ORA-16957: SQL Analyze time limit interrupt
- mysql 连接语句
- mysql 查询
- SQL Server 错误日志收缩(ERRORLOG)
- SQL Server 重置Identity标识列的值(INT爆了)
- mysql 表日常变化前几
- Mysql5.5安装
- Oracle dblink详解
- 2008 MSSQL的一个镜像安装步骤
- 25. oracle密码过期解决
- 用sqlyog打开.sql文件
- SQL优化--Exists和in的效率哪个高
- 采用Atlas+Keepalived实现MySQL读写分离、读负载均衡
- Redis 入门之 redis 列表操作
- mysqldump的一个小小问题
- SQL Server 数据库没有有效全部者的三种解决的方法
- redis 简单应用
- 读取大csv文件数据插入到MySql或者Oracle数据库通用处理
- mysql小问题
- 源码安装mysql