none
Lost connection to the database RRS feed

  • Question

  • Hello!

    I am using Visual Studio 2015.

    1) I created a small program in C# to change one data in a database ( using console )

    2) First I created the database by using the add-> new item > database tool.

    3) then I added an Entity Framework (ADO.NET Entity Data Model

    4) then wrote the following code in  the static void(.......) This code is from another user where RecipesEntities is the

    Entity framework, Table is the Table in Tables of the Recipes database.

    RecipesEntities context = new RecipesEntities();
               
                    Table recip = new Table()
                    {
                        Name = "Chicken Salad"
                    };
                    context.Tables.Add(recip);
                    context.SaveChanges();

    5)Before Starting the application I check the database using the Server Explorer and the connection is OK.(green)

    6) When I start the application the connection with the database is lost (turn red) and nothing can be change,

    7)I tried with other situations( Web Page and desk application, always the same situation!

    8) What can I do to get the database connection working?

    THANK you?

    • Moved by Bob Beauchemin Friday, October 21, 2016 4:40 PM Moved to forum for client-side SqlClient for best results
    Friday, October 21, 2016 1:21 PM

All replies