locked
How do i make an application that comes with a database? RRS feed

  • Question

  • I just made a password generator/manager that works great on my computer. what seems to happen when i try to copy the published file to my wife's computer it get the error 52 and fails to connect to the database
    Monday, April 21, 2014 1:58 AM

Answers

  • so the other computer is trying to connect to the original computer


    No, you are using LocalDB and that don't support remote connections from other machines. You would have to use SQL Express instead and enable remote connection to have a centralize SQL Server; LocalDB is only for single machine / local usage of applications.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:46 AM
    Monday, April 21, 2014 2:04 PM
    Answerer
  • then install LocalDB also on that machine, copy the mdf file to the machine name; then you only have to modify in the connection string the "AttachDbFilename" property to point to the mdf file

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by Naomi NEditor Monday, April 21, 2014 6:28 PM
    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:46 AM
    Monday, April 21, 2014 5:06 PM
    Answerer
  • In your connection string you have AttachDbFileName property. Copy the DB to the other computer and use correct path and file name. I suggest to use a simpler path than the one you're currently using.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog


    My TechNet articles

    • Proposed as answer by Sofiya Li Tuesday, April 22, 2014 7:09 AM
    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:46 AM
    Monday, April 21, 2014 6:30 PM
    Answerer

All replies

  • Hello,

    can you give some more details, please? Have you a central SQL Server which is accessible from the other machine? How does the connection string look like? Do the other user has permissions to logon to SQL Server? What the exact and complete error message?


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Monday, April 21, 2014 6:28 AM
    Answerer
  • well i am trying to make the database unique per computer so that it has it's own, 

    the connection string for the one on my computer is Data Source=(LocalDB)\v11.0;AttachDbFilename="C:\Users\derek\Documents\Visual Studio 2013\Projects\WindowsApplication3\WindowsApplication3\Database1.mdf";Integrated Security=True

    so the other computer is trying to connect to the original computer

    Monday, April 21, 2014 12:55 PM
  • so the other computer is trying to connect to the original computer


    No, you are using LocalDB and that don't support remote connections from other machines. You would have to use SQL Express instead and enable remote connection to have a centralize SQL Server; LocalDB is only for single machine / local usage of applications.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:46 AM
    Monday, April 21, 2014 2:04 PM
    Answerer
  • ya that is what i want, i want the application to have it's own database that is unique per computer, i am sorry i am very green at the gills with codeing
    Monday, April 21, 2014 4:58 PM
  • then install LocalDB also on that machine, copy the mdf file to the machine name; then you only have to modify in the connection string the "AttachDbFilename" property to point to the mdf file

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by Naomi NEditor Monday, April 21, 2014 6:28 PM
    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:46 AM
    Monday, April 21, 2014 5:06 PM
    Answerer
  • I am not sure exactly how to do that

    Monday, April 21, 2014 6:26 PM
  • In your connection string you have AttachDbFileName property. Copy the DB to the other computer and use correct path and file name. I suggest to use a simpler path than the one you're currently using.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog


    My TechNet articles

    • Proposed as answer by Sofiya Li Tuesday, April 22, 2014 7:09 AM
    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:46 AM
    Monday, April 21, 2014 6:30 PM
    Answerer
  • Use please :

    Data Source=.\v11.0;AttachDbFilename="Path\Database1.mdf";Integrated Security=True

    And replace (Path) with your real path of the file in every machine.

    Not the Data Source, i use :

    .\v11.0

    To specify the local machine.

    Monday, April 21, 2014 6:35 PM