KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Does SqlDataAdapter close the SqlConnection after the Fill() function or do I need close it myself? string cnStr = @"Data Source=TEST;Initial Catalog=Suite;Persist Security Info=True;User ID=app;Password=Immmmmm"; cn = new SqlConnection(cnStr); SqlCommand cmd = new SqlCommand("SELECT TOP 10 * FROM Date", cn); SqlDataAdapter adapter = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adapter.Fill(ds); cn.Close() // ???????? Console.WriteLine(ds.Tables[0].Rows.Count); Console.WriteLine(cn.State);
Tags (comma-separated)
Save Edits
Cancel