This question is related to this previous SO question
I have fixed the string used in the program so it now runs that line of code.
Why does the following fail on the line myAdapt.Fill(mySet, "AvailableValues");
with a error SQLException was Unhandled; A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections
The database is part of the project so why should there be difficulties connecting?
- I've tried running the sql string in a sql file and it runs ok.
I've tried deleting all columns from the DGV.
void PopulateGridView() { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DatabaseDGVexperiments.Properties.Settings.DatabaseDGVexperimentsConnStg"].ConnectionString); SqlDataAdapter myAdapt = new SqlDataAdapter("SELECT refText FROM helloworld", conn); DataSet mySet = new DataSet(); myAdapt.Fill(mySet, "AvailableValues"); DataTable myTable = mySet.Tables["AvailableValues"]; this.uxExperimentDGV.DataSource = myTable; }