Articles → ADO.NET → MARS In Ado.Net
MARS In Ado.Net
MultipleActiveResultSets = False(or true)
Column Name | Data Type |
---|
ContentID | int |
ContentDisplayName | varchar(50) |
IsActive | bool |
Column Name | Data Type |
---|
ContentTypeID | int |
ContentType | varchar(50) |
string connectionString = "Server = TestServer;Database = test_delete;User ID = sa;Password = sa;Trusted_Connection = False;MultipleActiveResultSets = True";
string content = "select top 1 * from tblContent";
string contenttype = "select top 1 * from tblContentType";
using (SqlConnection conn = new SqlConnection(connectionString))
SqlCommand cmdContent = new SqlCommand(content, conn);
SqlCommand cmdContentType = new SqlCommand(contenttype, conn);
using (SqlDataReader rdContent = cmdContent.ExecuteReader())
SqlDataReader rdcontentType = cmdContentType.ExecuteReader();
while (rdcontentType.Read())