locked
How many connection strings. RRS feed

  • Question

  • User279080766 posted
    After adding different things to my club site, I find I have five connection strings in the config file.  Are they really needed?  It seems to me draging a table onto a form not only creates a new datagrid and datasource, but also a new connection string.  And if you are not careful, using the wrong connection string will cause an the exception "database is already in use".
    Sunday, March 18, 2007 11:09 PM

Answers

  • User-503940700 posted

    There should be only one connection string in the config file and in case drag-drop of tables is creating new connection strings you an safely remove them from the config file and make the code use the existing connection string value.

    Hope this helps,

    Vivek 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 19, 2007 12:42 AM
  • User662902352 posted

    I am devloping both a web and desktop application with vb.net. During the process there have been several connection strings created that I will not use in the finished app. In the desktop applicaion I have removed the connection strings from the app.config but they still appear in the Object Browser under MySettings. Is there a way to remove these?

    I would like to be able to connect to my development computer while I am developing and then when I move the application to the server use the server connection. Can you tell me the best way to do this?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 10, 2007 11:34 AM

All replies

  • User-503940700 posted

    There should be only one connection string in the config file and in case drag-drop of tables is creating new connection strings you an safely remove them from the config file and make the code use the existing connection string value.

    Hope this helps,

    Vivek 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 19, 2007 12:42 AM
  • User-512273051 posted

    Yes in my opinion you should be selective in terms of connection String. multiple connection string is needed when you have multiple databases which are working on the web app. but if only one database is maintained you need to remove all the connection strings and set one for all.

    TIP: Use find command to remove same connectionstrings.

     

     cheers

    Monday, March 19, 2007 12:55 AM
  • User662902352 posted

    I am devloping both a web and desktop application with vb.net. During the process there have been several connection strings created that I will not use in the finished app. In the desktop applicaion I have removed the connection strings from the app.config but they still appear in the Object Browser under MySettings. Is there a way to remove these?

    I would like to be able to connect to my development computer while I am developing and then when I move the application to the server use the server connection. Can you tell me the best way to do this?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 10, 2007 11:34 AM