Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:31:27+00:00 2026-06-06T17:31:27+00:00

I have a website project (C#/ASP.NET) opened in Visual Studio 11 (beta) which works

  • 0

I have a website project (C#/ASP.NET) opened in Visual Studio 11 (beta) which works with the built-in SQL Server Compact Edition. But, I would rather use my SQL Server 2012 which is installed on this machine, and I have my tables already created in it.

Question is, how do connect to it from VS11? Do I add it in the App_Data folder where I have the Compact database?

Right now I am opening my pre-made database with the

var db = Database.Open("StarterSite");

command.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:31:29+00:00Added an answer on June 6, 2026 at 5:31 pm

    If you already have the database created on SQL Server 2012, then just use it!

    No need to add it to your project (and most definitely don’t copy it into App_Data!).

    Just create a connection string in your web.config something like:

    <connectionStrings>
       <add name="YourConnectionStringNameHere"
            connectionString="server=(local);database=YourDatabase;Integrated Security=SSPI;" />
    </connectionStrings>
    

    and then use that in your app using all the normal ADO.NET components like SqlConnection or SqlCommand:

    string connectionString = WebConfigurationManager.ConnectionStrings["YourConnectionStringNameHere"].ConnectionString;
    
    using (SqlConnection conn = new SqlConnection(connectionString))
    using (SqlCommand cmd = new SqlCommand("your-sql-statement-here", conn))    
    {
       // do work in your database here....
    }
    

    Or use something like Entity Framework to make your life even easier!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in Visual Studio 2010 I have a really big ASP.NET website project which has
We have a web site built as an 'ASP.NET Website' type project, rather than
I have a large website solution in visual studio comprised of an ASP.NET Website
I my asp.net website project with c# code, I have a table in which
We have a ASP.NET website project. In the past, we had been using asmx
i have a problem i am developing an asp.net mvc project. Website is in
I have an ASP.NET application which features some server-side includes. For example: <!--#include virtual=/scripts.inc
I have a WebSite project in Visual Studio 2008 (not a Web Application project!)
I have a website made in Asp.net MVC which is installed in the root
Hello I have a page in an ASP.NET (website) project that writes a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.