可以从SqlDataAdapter到DataSet并行填充吗?

时间:2015-09-07 05:27:26

标签: c# parallel-processing dataset sqldataadapter

我有这个简单的代码:

        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;

可以并行吗?

0 个答案:

没有答案