locked
database created in SQL Server 2008 - can we use in Asp.net project in Visual Studio 2015 RRS feed

  • Question

  • User-945256609 posted

    Dear all,

    I have created and used a database for my asp.net application in SQL Server 2008. Now I would like to use that database in Visual Studio 2015 - in my local system for testing and development.

    I am not getting the import option in visual studio 2015 application for this.

    Can anyone suggest a way to use this in my Visual Studio 2015 application.

    Cheers

    Sathya

    Thursday, July 7, 2016 4:25 AM

Answers

  • User-821857111 posted

    I have a *.bak file
    You need to restore that. Follow these steps:

    1. Create new empty database on the SQL Server on your laptop
    2. Right click on it and choose Tasks > Restore > Database
    3. In the dialog that appears, choose Device in the Source panel, and click the ellipses to locate the .bak file and click Add
    4. If you want to control the location where the restored database files will be created, click Files in the left hand side and amend the file paths in the Restore As column
    5. Click Options in the right and pane, and tick the first one - Overwrite the existing database (WITH REPLACE)
    6. Then click OK

    That will create a local copy of your production database. You should be able to connect to that from Visual Studio. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 7, 2016 11:42 AM

All replies

  • User1158849101 posted

    Sathya,

    This forum is specific for ASP.NET Core, if you want to use databse of SQL Server 2008 then answer some of my questions here

    1. Is it local db i.e. SQL Compact database?

    2. Are you planning to use ASP.NET MVC 5 and newly released ASP.NET Core? Interaction with DB is little different now.

    Thursday, July 7, 2016 7:12 AM
  • User-821857111 posted

    I would like to use that database in Visual Studio 2015
    Visual studio provides tools for managing a SQL Server database, but it can't be "imported" into an application. It can be accessed by the application using a connection string. What kind of application are you talking about?

    Thursday, July 7, 2016 7:18 AM
  • User-945256609 posted

    Dear Mike,

    Many thanks for your reply. I have not posted this in the right forum - kindly move this appropriately.

    Earlier I have used and created a asp.net application - I have started from scratch as an empty web application in visual studio 2010 and connection strings to my production database. Now I want to test this application in my personal laptop wherein I do not have access to my production database; but I have a *.bak file from that production environment. I have the application - but  unable to use this in visual studio.

    is that possible/if yes, let me know.

    thanks

    Sathya

    Thursday, July 7, 2016 8:51 AM
  • User-821857111 posted

    I have a *.bak file
    You need to restore that. Follow these steps:

    1. Create new empty database on the SQL Server on your laptop
    2. Right click on it and choose Tasks > Restore > Database
    3. In the dialog that appears, choose Device in the Source panel, and click the ellipses to locate the .bak file and click Add
    4. If you want to control the location where the restored database files will be created, click Files in the left hand side and amend the file paths in the Restore As column
    5. Click Options in the right and pane, and tick the first one - Overwrite the existing database (WITH REPLACE)
    6. Then click OK

    That will create a local copy of your production database. You should be able to connect to that from Visual Studio. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 7, 2016 11:42 AM