I'm using VS2012 and SQL Server Express 2008. I've boiled down my connection/query to try and find out why my DataSet
is not being filled. The connection is completed successfully, and no exceptions are thrown, but the adapter does not fill the DataSet
. The database that this is pulling from is on the same PC and using localhost\SQLEXPRESS
does not change the result. Thanks for any input!
SqlConnection questionConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
questionConnection.Open();
String sql = "SELECT * FROM HRA.dbo.Questions";
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds = new DataSet();
SqlCommand command = new SqlCommand(sql, questionConnection);
adapter.SelectCommand = command;
adapter.Fill(ds);
adapter.Dispose();
command.Dispose();
questionConnection.Close();
Connection String:
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=CODING-PC\SQLEXPRESS;Initial Catalog=HRA;User ID=sa; Password= TEST" />