c# - Using existing Database File but using SQL Server Express -


i have existing database named financialhub.mdf in app_data folder. using (localdb)\mssqllocaldb if i'm not wrong. want change sql server express because i'm encountering major errors when publishing website onto iis when wanting access database.

i'm using visual studio 2015 , think saw control panel i'm using microsoft sql server 2012 can't seem find sql tools. how check if have tools?

may ask how connect sql server express? tried find sql server configuration management or in computer can't seem find anything..

could please provide step-by-step guide on how use existing .mdf database file , getting connection work database sql server express?

i tried using 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 doesn't work @ all.....

first link previous questions

second link previous questions

currently programs have microsoft sql server control panel:

picture

connectionstring 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"/> 

if can't find in sql server configuration manager - don't have installed - plain , simple. first step: sql server 2012 express (or newer version), install it, , check again if see in configuration manager.

then, once you've installed sql server express, find in configuration manager , see instance name - default installs .\sqlexpress (but can change @ installation time).

then, using management studio, connect instance (specify .\sqlexpress server/instance name), , attach existing .mdf file database in sql server express.

once that's done, can access database in sql server express using connection string this:

<connectionstrings>     <add name="connstr"           connectionstring="data source=.\sqlexpress;initial catalog=financialhub;integrated security=true;          providername="system.data.sqlclient" /> </connectionstrings> 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -