SqlCommand怎么取消大数据量查询
来源:互联网 发布:林珊珊淘宝店 编辑:程序博客网 时间:2024/04/28 15:40
1、用异步方式进行查询
SqlConnection con;
SqlCommand com;try
{
con = new SqlConnection("UID=sa;Password=123;Initial Catalog=AD;Data Source=192.168.1.1;Asynchronous Processing=true");
con.Open();
com = new SqlCommand("select top 100 * from tb_user", con);
com.BeginExecuteReader(new AsyncCallback(
delegate(IAsyncResult ar)
{
if (ar.IsCompleted)
{
SqlCommand tempCom = (SqlCommand)ar.AsyncState;
SqlDataReader tempDr = tempCom.EndExecuteReader(ar);
DataTable dt = new DataTable();
dt.Load(tempDr);
tempDr.Close();
}
}
), com);
}
catch (Exception ex)
{
MessageBox.Show("程序发生错误,信息: " + ex.Message);
}
2、在合适的地方调用 com.Cancel();
- SqlCommand怎么取消大数据量查询
- 大数据量查询
- 浅谈大数据量查询
- sql 大数据量查询
- 大数据量查询优化
- 大数据量查询的优化
- mysql 数据库大数据量查询
- Silverlight大数据量查询实现
- 大数据量查询优化性能
- 大数据量模糊查询优化
- oracle 大数据量分页查询
- Oracle大数据量优化查询
- pl/sql 查询数据量大时, 怎么提高输出缓存大小?
- 大数据量绘图,怎么提高速度
- 大数据量翻页查询的一点经验
- 如何处理大数据量的查询
- 如何处理大数据量的查询
- 如何处理大数据量的查询
- 2013暑期总结
- ThinkPHP 3.1.2 视图
- JMS和消息驱动Bean(MDB)
- Exercises 3.3 E7
- python file backup
- SqlCommand怎么取消大数据量查询
- Android异常:could not find class android.support.v4.view.ViewPager
- Webservice-WSDL详解(三)
- linux 自动执行 crontab学习笔
- Web安全测试之XSS
- Android中全局变量的实现方法
- (转)AWK 简明教程
- UDK清除屏幕显示信息---------警告或者错误
- LeetCode 16: 3Sum Closest