As we know Ms Sql 2000 does not support MultipleActiveResultSets.
Can i use Dapper with async Task without exceptions :
"There is already an open DataReader associated with this Command which must be closed first."
My code example
private async void Form_Load(object sender, EventArgs e){
var sql1 = "select * from Tab1";
var sql2 = "select * from Tab2";
var sql3 = "select * from Tab3";
await Task.Factory.StartNew(() => FillComboBoxWithData(this.cbo1, sql1));
await Task.Factory.StartNew(() => FillComboBoxWithData(this.cbo2, sql2));
await Task.Factory.StartNew(() => FillComboBoxWithData(this.cbo3, sql3));
}
public static async Task FillComboBoxWithData(ComboBox comboBox, string sql{
try
{
var data = await Task.Factory.StartNew(() => SqlConn.Query<IdName>(sql));
var d1 = data.ToNonNullList();
comboBox.DataSource = d1;
comboBox.DisplayMember = "Name";
comboBox.ValueMember = "Id";
comboBox.SelectedItem = null;
}
catch (Exception ex)
{
Console.Write(ex.ToString());
}
}
Thank you.