Problems with Entity Framework User Control

1

I have a clean installed PC with just Visual Studio, I made a user control with a datagridview that makes a connection to a locally created database

private void Docs_Load(object sender, EventArgs e)
{
    using (DatabaseContext db = new DatabaseContext())
    {
        docsBindingSource.DataSource = db.Docs.ToList();
    }
}

When I try to add the user control to my form, I get the following error:

Failed to create component: "MyUserControl" System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server

What is causing this error? I tried to restart the SQL Server VSS Writer service but without success, I could not find any other problems online that could be causing the error

Edit: it does work when using the datagrid on the form so I think that the user control does not have acces to the database

entity-framework
user-controls
asked on Stack Overflow Jun 25, 2018 by Dan • edited Jun 25, 2018 by Dan

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0