Not able to connect to db using C#. RRS feed

  • Question

  • Hello, 

    - I have developed c# application and installed it. But it is throwing exception, so i tried to connect that .mdf file using vs studio application.

    - My installed app app.config has a path as

    C:\\Program Files\\KB DEMO APP\\KBAPPDemoSetup\\KB DEMO App\\KBDDemo.mdf;Initial Catalog=KBDemoDB;Integrated Security=True

    and mdf file name in the installed directory has name as KBD.mdf

    When i tried using VS Studio, i found that it is referring to nonn existing connection as follows:

    Database 'C:\\Program Files\\KB DEMO APP\\KBAPPDemoSetup\\KB DEMO App\\KBData.mdf' already exists. Choose a different database name.
    Cannot attach the file 'C:\\Program Files\\KBAPP Setup\\KBD.mdf' as database 'KBDemoDB'.

    Please tell me what is going wrong?

    • Edited by NirajZ Tuesday, January 9, 2018 7:24 AM
    Tuesday, January 9, 2018 7:22 AM


  • Solved this issue by just creating a blank db, transfer all tables, sps and table types from original one using built in functionality and done. Which helped me to create to new db with new .ldf file.
    • Marked as answer by NirajZ Tuesday, January 9, 2018 5:23 PM
    Tuesday, January 9, 2018 5:23 PM

All replies