Share via

Property accessor ConnectionStringObject error in Winforms C# project

Christopher Durieu 20 Reputation points
2026-04-28T11:22:03.0833333+00:00

I am doing a Winforms project, c#, and suddenly, I started getting this error....

Does someone have an idea how to fix this?Screenshot 2026-04-28 081158

Developer technologies | Windows Forms
0 comments No comments

Answer accepted by question author

Gade Harika (INFOSYS LIMITED) 2,850 Reputation points Microsoft External Staff
2026-04-28T11:57:20.83+00:00

Thanks for reaching out.
This issue usually occurs when Visual Studio cannot resolve the connection string used by the WinForms Designer at design-time.

Common causes:

  • Corrupted or missing connection string in App.config or Settings.settings
  • Database file (.mdf) path changed or missing
  • Broken Data Source configuration

Try the following steps:

Verify App.config Make sure your connection string is valid and points to the correct .mdf file.

Recreate Data Source

  • Open Data Sources window
    • Delete the existing data source
      • Add it again using “Add New Data Source”
      Check Settings.settings
      - Remove any invalid connection entries
      
         - Recreate them using the designer
      
  1. Confirm database file exists Ensure the .mdf file is present and set: Copy to Output Directory = Copy if newer Clean and rebuild solution
       Build → Clean Solution
    

Build → Rebuild Solution

   
1. If the issue persists, delete `bin` and `obj` folders and reopen the solution.  
  
Let me know if you need any further help with this. I will be happy to assist. If you find this helpful, Kindly mark the provided solution as **"Accept Answer",** so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. AI answer

    2026-04-28T11:22:14.71+00:00

    The error indicates that Visual Studio’s designer cannot find or resolve the connection-string setting in the application settings for the data source used by the designer. In this situation, Visual Studio falls back to the connection string stored in the .dbml (or design-time data source) file.

    To fix it in the designer:

    1. In the dialog, select OK.
    2. Visual Studio will automatically create (or correct) the missing connection-string entry in the application settings based on the connection information stored in the design file.

    After clicking OK, the connection information from the design file is added to the application settings, and the designer should load without further errors.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.