locked
Connection to SQL Database RRS feed

  • Question

  • User174724410 posted

    Hello,

    I  have connection to Database Name.mdf
    I want to have  connection to SQL DAtabase which I created NameSQL.dbo

    Here it is how it looks like for now: 

    <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Name.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />

    How should it looke like?

    Thursday, May 22, 2014 5:19 AM

Answers

All replies

  • User-2007877324 posted

    Please make the below change

    |DataDirectory|\Name.mdf

    "\" is missing

    Thursday, May 22, 2014 5:41 AM
  • User174724410 posted

    But I do not want to have Name.mdf as default Database. I want to my NameSQL.dbo be  a default Database. I know that sth more than just the name bust be changed. That's why I am asking.

    Thursday, May 22, 2014 5:47 AM
  • User-2007877324 posted

    Use connectionstrings.com to generate the connection you need

    http://www.connectionstrings.com/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 22, 2014 6:17 AM