locked
Can't Connect to the table azure SQL in given DB connection using .net RRS feed

  • Question

  • My question is the Azure DB connection is working perfectly but when i use the sample Todo by given in the link https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-dotnet-sqldatabase

    so i have already table in the database called "PhotoTable" but every time i run the sample (asp.net)it creates it own table ( Todoes table)in my DB ( DB is already i created and its connect fine with my existing DB) so the issue is its not connecting with mt table , i have done changing the controller and all other stuff , but it dosen't work, if anyone knows how to connect with existing table please kindly let me know , thanks ( if more information needed please let me know, i have added the screenshot of my table list and the table i need to connect i have highlighted with red)

    Monday, July 2, 2018 3:10 PM

All replies

  • My question is the Azure DB connection is working perfectly but when i use the sample Todo by given in the link https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-dotnet-sqldatabase

    so i have already table in the database called "PhotoTable" but every time i run the sample (asp.net)it creates it own table ( Todoes table)in my DB ( DB is already i created and its connect fine with my existing DB) so the issue is its not connecting with mt table , i have done changing the controller and all other stuff , but it dosen't work, if anyone knows how to connect with existing table please kindly let me know , thanks ( if more information needed please let me know, i have added the screenshot of my table list and the table i need to connect i have highlighted with red)

    Good day ?!?

    Your question is not related to the Azure SQL Database (since you connect the database well) but to the application side, and therefore you better ask the question in the right forum. In fact the same behavior will happen in local server.

    The application that you try to use is based on ASP.Net MVC Entity Framework Code First. Using this approach the application creates the database structure (which is why it named "Code First" - we write the application code including the classes of the objects and the ORM named Entity Framework Code First creates the elements in the databases according to our application classes.

    The best forum for the question is in the ASP.Net website. They have saparate forum's interface which mean we cannot move the thread there, and you will need to start a new question: https://forums.asp.net/

    1. I HIGHLY recommend to learn the basic of Entity Framework Code First before you try to implement application which someone else wrote. This links is your best option probably:

    https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

    2. The name of the table is define in your Classes, Again I highly recommedn to lear in ordinarily way but in short (which I do not recommend) you can read more about the mapping between the Database tables and the code in this page:

    http://www.entityframeworktutorial.net/code-first/configure-entity-mappings-using-fluent-api.aspx 


    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]




    Tuesday, July 3, 2018 2:40 AM