I am trying to pull in data from a Microsoft Access database file, in order to populate several textboxes. (The textboxes are all done in XAML.) I'm quite sure I'm missing something, because the database file isn't accessed.
Here is my code:
DataTable tblVFWPostManagers = new DataTable();
string connString2 = ConfigurationManager.ConnectionStrings**/*["\\Documents\DatabaseFile.accdb"]*/**.ConnectionString;
string query2 = @"SELECT Manager ID, Manager FName, Manager LName, Manager Address, Manager City, Manager State, Manager Zip Code,
Manager Home Phone Number, Manager Cell Phone Number, Manager Email FROM tblVFWPostManagers";
//Fill the VFWPostManagers Set with the data
using (SqlConnection conn2 = new SqlConnection(connString2))
{
SqlDataAdapter da2 = new SqlDataAdapter(query2, conn2);
da2.Fill(tblVFWPostManagers);
}
Note: I'm sure the bolded is incorrect. However, I'm not really sure what goes in those brackets. I assumed, at first, that it was where the filepath went. When I commented that section out, the error disapperead though.
How can I pull in the data from my database using the above method? What am I missing?
ConfigurationManager.ConnectionStrings["MyConnString"].ConnectionString. Inside of app.config will have<add name="MyConnString" connectionString="whatever"/>