人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

May 13, 2007

Multiple Acrive Result Sets(MARS) in .NET 2.0

Filed under: SQL&DB Accessing

Using MADS to Execute multiple commands on a connecton.

Add MultipleActiveResultSets=true into the connection string.

新:.NET 2.0提供的异步数据访问

Filed under: SQL&DB Accessing

在connection string中指定 Asynchronous Processing = true.
Sample:
string strConn = “Data Source=.; Database=Pubs; Integrated Security=true; Asynchronous Processing=true”;
using (SqlConnection cn = new SqlConnection(strConn))
{
using(SqlCommand cmd = cn.CreateCommand())
{
cmd.CommandText = “”;
IAsyncResult ar = command.BeginExecuteReader();
// …
// do other processing
// …
SqlDataReader r = command.EndExecuteReader(ar);
}
}

参考
Asynchronous Command Execution in ADO.NET 2.0
http://msdn2.microsoft.com/en-us/library/ms379553(VS.80).aspx






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham