dcsimg
Results 1 to 5 of 5

Thread: Which server?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Which server?

    Hello

    I am trying to connect to a database as part of an attempt to use ASP.NET Identity for user registration and login aspx and aspx.vb files.

    I am not sure which server I am supposed to be accessing. In Solution Explorer, in my App_Data folder, there is nothing. The projet, hosted on my C drive in a folder called WebFormsIdentity, houses another folder called App_Data, and I see this:

    Name:  Inside_App_Data.jpg
Views: 99
Size:  13.1 KB

    Inside my Control Panel, I have:

    Name:  SQL_CP.jpg
Views: 104
Size:  58.0 KB

    Anyway, in VS 2017, I selected Tools | Connect to Database, and I now see this:

    Name:  whichServer.jpg
Views: 94
Size:  33.1 KB

    Is this the server I should be choosing or the Express Server?

    Thank you.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,586

    Re: Which server?

    Identity will use a LocalDB instance by default but, if you want your user management to use the same database as the rest of your data, it's up to you to generate the appropriate schema in your existing database and then direct Identity to that database.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Which server?

    I have downloaded Microsoft SQL Server Express LocalDB and it is installed here:

    Code:
    C:\Program Files\Microsoft SQL Server\110\LocalDB\Binn\
    Then, in VS 2017, in Tools | Connect to a database | Add Connection, I have Microsoft SQL Server Database File (SqlClient) as the Data source

    and

    Code:
    C:\Program Files\Microsoft SQL Server\110\LocalDB\Binn\mssqlsystemresource.mdf
    as the Database file name

    Name:  AddConnectionDB.jpg
Views: 57
Size:  60.2 KB

    When I then click on the Advanced button, I have selected

    Code:
    AttachDBFileName: C:\Program Files\Microsoft SQL Server\110\LocalDB\Binn\mssqlsystemresource.mdf
    
    Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="C:\Program Files\Microsoft SQL Server\110\LocalDB\Binn\mssqlsystemresource.mdf";
    Name:  AdvancedProperties.jpg
Views: 57
Size:  57.0 KB

    to correspond to the path of where Express LocalDB is installed. But when I test the connection, a dialogue-box tells me that my database file is not compatible with the current instance of SQL Server. So, I need to upgrade the database file or modify my existing connection to the database file I am using.

    When it says Database file, does it mean that I have to upgrade this: Microsoft SQL Server Database File (SqlClient)?

    Thanks again.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,586

    Re: Which server?

    Quote Originally Posted by SteveHi View Post
    I have downloaded Microsoft SQL Server Express LocalDB and it is installed here:
    You shouldn't need to do that separately. LocalDB is one of the individual components that you can select and deselect in the VS 2017 installer. The result may be the same but, if you do it through the VS installer then you know that you're getting exactly what VS expects.

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,586

    Re: Which server?

    You don't specify the path of the LocalDB installation in your connection string. The point of LocalDB is that the MDF file is part of your project. You add the MDF file to your project, either directly or indirectly, and then you specify the appropriate path in your connection string. For a web app with an App_Data folder, that's where you put your data files (the clue is in the name) and then, in your connection string, you use "|DataDirectory|" as the folder path, i.e.
    Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="|DataDirectory|\mssqlsystemresource.mdf";

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width