我有这个简单的代码:
DataSet ds = new DataSet();
using (SqlConnection con = new SqlConnection(connectionString))
using (SqlCommand cmd = new SqlCommand(sqlStatement, con))
{
con.Open();
cmd.CommandTimeout = commandTimeOut;
cmd.CommandType = isStoredProcedure ? CommandType.StoredProcedure : CommandType.Text;
if (parameters != null) //there are parameters to this query
{
foreach (string key in parameters.Keys)
cmd.Parameters.AddWithValue(key, parameters[key]);
}
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
da.Fill(ds);
}
}
return ds;
可以并行吗?