Connection Class RRS feed

  • Question

  • User1979860870 posted


       I don't want to write below line in every Class . I want to declare it once only & then use

        string cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;  


    Monday, May 24, 2021 11:11 AM

All replies

  • User475983607 posted

    Usually, the connection string line shows once in a data access layer library.  It is initialized in a constructor or global member.  It's not clear how your code is designed or if this is even possible in your current design.  

    Monday, May 24, 2021 11:18 AM