I have tried MultipleActiveResultSets=true in the connection string with no luck.
Here is my code:
SqlConnection conn2 = new SqlConnection("Data Source=*********;Integrated Security=False;User ID=roadman1977;password=*******");
conn2.Open();
SqlCommand com2 = new SqlCommand("SELECT COUNT (*) FROM SiteUser WHERE Username = @Username", conn2);
com2.Parameters.AddWithValue("@Username", txtUsername.Text);
SqlDataReader Read = com2.ExecuteReader();
SqlCommand com3 = new SqlCommand("SELECT COUNT (*) FROM SiteUser WHERE License = @License", conn2);
com3.Parameters.AddWithValue("@Username", txtLicense.Text);
SqlDataReader Read3 = com3.ExecuteReader();
Jignesh TrivediPosted Sep 12, 2014, 12:29 AM
hi,
have you tried following link
http://www.codeproject.com/Articles/306722/Executing-multiple-SQL-statements-as-one-against-S
This can be achieve by NextResult method of SQL data reader...
hope this will help you.