- Open SQL Server Management Studio (SSMS).
- Connect to your local SQL Server instance.
- Right-click on "Databases" in the Object Explorer.
- Select "Attach" and choose the
Virtual_classroom.mdffile.
- After attaching the database, right-click on it in SSMS.
- Choose "Properties" and navigate to the "File" tab.
- Note down the "Path" of the
.mdffile.
-
Open your ASP.NET project in Visual Studio.
-
Locate the
web.configfile in the project's root directory. -
Update the connection string in
web.configto point to the database file path:<connectionStrings> <add name="MyConnectionString" connectionString="Data Source=.\SQLExpress;AttachDbFilename=PATH_TO_YOUR_DATABASE_MDF;Integrated Security=True;" providerName="System.Data.SqlClient" /> </connectionStrings>
Replace
PATH_TO_YOUR_DATABASE_MDFwith the path obtained in the previous step.