1

I have an existing database named FinancialHub.mdf in my App_Data folder. Previously I was using (LocalDB)\MSSQLLocalDB if I'm not wrong. Now I want to change it to SQL Server Express because I'm encountering major errors when publishing my website onto IIS when wanting to access the database.

I'm using Visual Studio 2015 and I think I saw from my Control Panel that I'm using Microsoft SQL Server 2012 but I can't seem to find any SQL Tools. How do I check if I have any tools?

May I ask how do I connect to SQL Server Express? I tried to find for SQL Server Configuration Management or something in my computer but I can't seem to find anything..

Could anyone please provide a step-by-step guide on how to use my existing .mdf database file and getting the connection to work to the database with SQL Server Express?

I tried using this for web.config

<connectionStrings>
    <!--<add name="ConnStr" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFileName=|DataDirectory|\FinancialHub.mdf;Integrated Security=True" />-->
    <add name="ConnStr" 
         connectionString="Data Source=\\.\pipe\LOCALDB#FAA25AC9\tsql\query\SQLExpress;Initial Catalog=C:\USERS\DOM\DOCUMENTS\VISUAL STUDIO 2015\WEBSITES\FINANCIALHUB\APP_DATA\FINANCIALHUB.MDF;Integrated Security=True;User Instance=True" 
         providerName="System.Data.SqlClient" />
</connectionStrings>

But it doesn't work at all.....

First Link to Previous Questions

Second Link to Previous Questions

Currently what programs i have for Microsoft SQL Server from Control Panel:

picture

Connectionstring for SQLExpress editing marc_s Connectionstring:

<add name="ConnStr" connectionString="Data Source=DOMINIC-LIM\SQLExpress;Initial Catalog=C:\USERS\DOM\DOCUMENTS\VISUAL STUDIO 2015\WEBSITES\FINANCIALHUB\APP_DATA\FINANCIALHUB.MDF;Integrated Security=True;" providerName="System.Data.SqlClient"/>
domster
  • 556
  • 2
  • 8
  • 26
  • 1
    If you can't find anything in SQL Server Configuration Manager - then you don't have anything installed - plain and simple. So first step: get SQL Server 2012 Express (or a newer version), install it, and then check again if you see anything in the configuration manager. – marc_s Jul 28 '17 at 18:19
  • Will proceed to doing that immediately. I initially thought installing vs 2015 will get me even sql server.. What can i do from there on? Is my connection string correct? Or is the data source supposed to be .\SQLEXPRESS? – domster Jul 28 '17 at 18:20

2 Answers2

2

If you can't find anything in SQL Server Configuration Manager - then you don't have anything installed - plain and simple. So first step: get SQL Server 2012 Express (or a newer version), install it, and then check again if you see anything in the configuration manager.

Then, once you've installed SQL Server Express, find it in Configuration Manager and see what its instance name is - by default it installs as .\SQLEXPRESS (but you can change that at installation time).

Then, using Management Studio, connect to that instance (specify .\SQLEXPRESS as the server/instance name), and then attach your existing .mdf file as a database in SQL Server Express.

Once that's done, now you can access that database in SQL Server Express using a connection string something like this:

<connectionStrings>
    <add name="ConnStr" 
         connectionString="Data Source=.\SQLExpress;Initial Catalog=FinancialHub;Integrated Security=True;
         providerName="System.Data.SqlClient" />
</connectionStrings>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • SQL Server 2014 LocalDB With Service Pack 1 32/64-bit (English) i downloaded this marc_s. Will that work? Reason being i think u saw my posts about error connecting to db when publishing my website onto IIS on localhost and someone mentioned that using SQLEXPRESS is better or rather more ideal than using LocalDB. – domster Jul 28 '17 at 18:26
  • 2
    @domster: **no** - the "LocalDB" version is the developer version that only runs when Visual Studio runs. This is exactly what you already have - but you need a **full** version of SQL Server Express (see [Scott Hanselman's download page](https://www.hanselman.com/blog/DownloadSQLServerExpress.aspx) – marc_s Jul 28 '17 at 18:56
  • thank you marc_s everything has been solved. now i'll move on to pubishing my website on IIS. – domster Jul 29 '17 at 06:27
1

SQL Express from my understanding is just a stripped down version of SQL Server.

See this link for more information

From the image that I see, you have multiple versions of SQL installed but none of them have the express version. You can find the latest version of Express here. Unless there is some reason you absolutely need to use 2012 I would recommend using 2016.

As for tools, you may need to download and install the tools. SQL Server Managment Studio may be what you're looking for and I believe that the latest version can be found at this location

SDSMTKyzer
  • 112
  • 10
  • No, service pack is not what you want. It's been a very long time since I've downloaded just SSMS especially for 2012 but I remember there being an option someplace to choose which tools to install. – SDSMTKyzer Jul 28 '17 at 18:32
  • Which version of SQL Server do you have installed right now? Any? If not then you will want The entire Server with Tools – SDSMTKyzer Jul 28 '17 at 18:33
  • 1
    I'm doing some research and I will revise my answer because some information I stated may be wrong. Also, you appear to have multiple instances of SQL Server DB running. If this is not necessary, I'd recommend uninstalling as to avoid confusion. Do not quote me on this but I believe that since you have 2016 installed, that will be the one that automatically starts. – SDSMTKyzer Jul 28 '17 at 18:46
  • 1
    Answer revised. – SDSMTKyzer Jul 28 '17 at 18:51
  • I will uninstall all that i have accordingly and go forward with 2016 ver. Edit: I just read the description, i'll go ahead and install 2016 SP1 Express. Thanks SDSMTKyzer! – domster Jul 28 '17 at 18:54
  • i'll try out later on my own with Google.. Thank you so much for your help. It's 3.30am here.. – domster Jul 28 '17 at 19:29