Array of db connections with string subscription

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    Array of db connections with string subscription

    Hi

    Can I have an array of type OleDb.OleDbConn ection that has strings as
    subscription values? The reason I need this is my app reads a configuration
    file with db names and their locations and it then creates all connections
    and if subscript is the db name as string then it is easy for the app to
    figure out which db is which and to link it with other db settings in the
    configuration file.

    Thanks

    Regards


  • Spam Catcher

    #2
    Re: Array of db connections with string subscription

    "John" <John@nospam.in fovis.co.ukwrot e in
    news:#LWF8ScUIH A.3916@TK2MSFTN GP02.phx.gbl:
    Can I have an array of type OleDb.OleDbConn ection that has strings as
    subscription values? The reason I need this is my app reads a
    configuration file with db names and their locations and it then
    creates all connections and if subscript is the db name as string then
    it is easy for the app to figure out which db is which and to link it
    with other db settings in the configuration file.
    You can store several connections in a hashtable. However, it is best to
    open/close connections as you need them and not keep several connections
    open.

    --
    spamhoneypot@ro gers.com (Do not e-mail)

    Comment

    • John

      #3
      Re: Array of db connections with string subscription

      Can hashtable be of type OleDb.OleDbConn ection?

      Thanks

      Regards

      "Spam Catcher" <spamhoneypot@r ogers.comwrote in message
      news:Xns9A1F19E 07CD1Busenethon eypotrogers@127 .0.0.1...
      "John" <John@nospam.in fovis.co.ukwrot e in
      news:#LWF8ScUIH A.3916@TK2MSFTN GP02.phx.gbl:
      >
      >Can I have an array of type OleDb.OleDbConn ection that has strings as
      >subscription values? The reason I need this is my app reads a
      >configuratio n file with db names and their locations and it then
      >creates all connections and if subscript is the db name as string then
      >it is easy for the app to figure out which db is which and to link it
      >with other db settings in the configuration file.
      >
      You can store several connections in a hashtable. However, it is best to
      open/close connections as you need them and not keep several connections
      open.
      >
      --
      spamhoneypot@ro gers.com (Do not e-mail)

      Comment

      • Miha Markic

        #4
        Re: Array of db connections with string subscription

        You mean the value part? Sure, why not.
        However, I would recommend, as stated in previous post, to avoid retaining
        connections - that's the connection pool's job.

        --
        Miha Markic [MVP C#, INETA Country Leader for Slovenia]
        RightHand .NET consulting & development www.rthand.com
        Blog: http://cs.rthand.com/blogs/blog_with_righthand/

        "John" <John@nospam.in fovis.co.ukwrot e in message
        news:Oxa9r1cUIH A.536@TK2MSFTNG P06.phx.gbl...
        Can hashtable be of type OleDb.OleDbConn ection?

        Comment

        • John

          #5
          Re: Array of db connections with string subscription

          Thank. Could you tell ma how to declare a hashtable of type
          OleDb.OleDbConn ection with a string type subscript?

          Thanks

          regards


          "Miha Markic" <miha at rthand comwrote in message
          news:u9CGM6cUIH A.1168@TK2MSFTN GP02.phx.gbl...
          You mean the value part? Sure, why not.
          However, I would recommend, as stated in previous post, to avoid retaining
          connections - that's the connection pool's job.
          >
          --
          Miha Markic [MVP C#, INETA Country Leader for Slovenia]
          RightHand .NET consulting & development www.rthand.com
          Blog: http://cs.rthand.com/blogs/blog_with_righthand/
          >
          "John" <John@nospam.in fovis.co.ukwrot e in message
          news:Oxa9r1cUIH A.536@TK2MSFTNG P06.phx.gbl...
          >Can hashtable be of type OleDb.OleDbConn ection?
          >

          Comment

          • Miha Markic

            #6
            Re: Array of db connections with string subscription

            What .net version are you using?

            --
            Miha Markic [MVP C#, INETA Country Leader for Slovenia]
            RightHand .NET consulting & development www.rthand.com
            Blog: http://cs.rthand.com/blogs/blog_with_righthand/

            "John" <John@nospam.in fovis.co.ukwrot e in message
            news:%23$k%23D9 cUIHA.1744@TK2M SFTNGP05.phx.gb l...
            Thank. Could you tell ma how to declare a hashtable of type
            OleDb.OleDbConn ection with a string type subscript?
            >
            Thanks
            >
            regards
            >
            >
            "Miha Markic" <miha at rthand comwrote in message
            news:u9CGM6cUIH A.1168@TK2MSFTN GP02.phx.gbl...
            >You mean the value part? Sure, why not.
            >However, I would recommend, as stated in previous post, to avoid
            >retaining connections - that's the connection pool's job.
            >>
            >--
            >Miha Markic [MVP C#, INETA Country Leader for Slovenia]
            >RightHand .NET consulting & development www.rthand.com
            >Blog: http://cs.rthand.com/blogs/blog_with_righthand/
            >>
            >"John" <John@nospam.in fovis.co.ukwrot e in message
            >news:Oxa9r1cUI HA.536@TK2MSFTN GP06.phx.gbl...
            >>Can hashtable be of type OleDb.OleDbConn ection?
            >>
            >
            >

            Comment

            • John

              #7
              Re: Array of db connections with string subscription

              I am on vs2008, can use any.

              Regards

              "Miha Markic" <miha at rthand comwrote in message
              news:uWrcdYdUIH A.4196@TK2MSFTN GP04.phx.gbl...
              What .net version are you using?
              >
              --
              Miha Markic [MVP C#, INETA Country Leader for Slovenia]
              RightHand .NET consulting & development www.rthand.com
              Blog: http://cs.rthand.com/blogs/blog_with_righthand/
              >
              "John" <John@nospam.in fovis.co.ukwrot e in message
              news:%23$k%23D9 cUIHA.1744@TK2M SFTNGP05.phx.gb l...
              >Thank. Could you tell ma how to declare a hashtable of type
              >OleDb.OleDbCon nection with a string type subscript?
              >>
              >Thanks
              >>
              >regards
              >>
              >>
              >"Miha Markic" <miha at rthand comwrote in message
              >news:u9CGM6cUI HA.1168@TK2MSFT NGP02.phx.gbl.. .
              >>You mean the value part? Sure, why not.
              >>However, I would recommend, as stated in previous post, to avoid
              >>retaining connections - that's the connection pool's job.
              >>>
              >>--
              >>Miha Markic [MVP C#, INETA Country Leader for Slovenia]
              >>RightHand .NET consulting & development www.rthand.com
              >>Blog: http://cs.rthand.com/blogs/blog_with_righthand/
              >>>
              >>"John" <John@nospam.in fovis.co.ukwrot e in message
              >>news:Oxa9r1cU IHA.536@TK2MSFT NGP06.phx.gbl.. .
              >>>Can hashtable be of type OleDb.OleDbConn ection?
              >>>
              >>
              >>
              >

              Comment

              • Miha Markic

                #8
                Re: Array of db connections with string subscription

                You can use Dictionary<K,Vt hen, i.e.
                Dictionary<stri ng, OleDbConnection dict = new Dictionary<stri ng,
                OleDbConnection >();
                dict.Add("...", conn);

                --
                Miha Markic [MVP C#, INETA Country Leader for Slovenia]
                RightHand .NET consulting & development www.rthand.com
                Blog: http://cs.rthand.com/blogs/blog_with_righthand/

                "John" <John@nospam.in fovis.co.ukwrot e in message
                news:%23phnE3dU IHA.5980@TK2MSF TNGP04.phx.gbl. ..
                >I am on vs2008, can use any.
                >
                Regards
                >
                "Miha Markic" <miha at rthand comwrote in message
                news:uWrcdYdUIH A.4196@TK2MSFTN GP04.phx.gbl...
                >What .net version are you using?
                >>
                >--
                >Miha Markic [MVP C#, INETA Country Leader for Slovenia]
                >RightHand .NET consulting & development www.rthand.com
                >Blog: http://cs.rthand.com/blogs/blog_with_righthand/
                >>
                >"John" <John@nospam.in fovis.co.ukwrot e in message
                >news:%23$k%23D 9cUIHA.1744@TK2 MSFTNGP05.phx.g bl...
                >>Thank. Could you tell ma how to declare a hashtable of type
                >>OleDb.OleDbCo nnection with a string type subscript?
                >>>
                >>Thanks
                >>>
                >>regards
                >>>
                >>>
                >>"Miha Markic" <miha at rthand comwrote in message
                >>news:u9CGM6cU IHA.1168@TK2MSF TNGP02.phx.gbl. ..
                >>>You mean the value part? Sure, why not.
                >>>However, I would recommend, as stated in previous post, to avoid
                >>>retaining connections - that's the connection pool's job.
                >>>>
                >>>--
                >>>Miha Markic [MVP C#, INETA Country Leader for Slovenia]
                >>>RightHand .NET consulting & development www.rthand.com
                >>>Blog: http://cs.rthand.com/blogs/blog_with_righthand/
                >>>>
                >>>"John" <John@nospam.in fovis.co.ukwrot e in message
                >>>news:Oxa9r1c UIHA.536@TK2MSF TNGP06.phx.gbl. ..
                >>>>Can hashtable be of type OleDb.OleDbConn ection?
                >>>>
                >>>
                >>>
                >>
                >
                >

                Comment

                Working...