Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. connection string

connection string

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
8 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vnsraj
    wrote on last edited by
    #1

    Hi Everyone, In my website when user login then I make connection string and store connection to the class in static variable. when user navigation different page in site I take connection string from class file and create connect to the DB. But my problem is that when another user login the first user connection string was change to last user connection string, reason is static variable. There is any solutions.....please help me out Thanks Raj

    Y A S P E 5 Replies Last reply
    0
    • V vnsraj

      Hi Everyone, In my website when user login then I make connection string and store connection to the class in static variable. when user navigation different page in site I take connection string from class file and create connect to the DB. But my problem is that when another user login the first user connection string was change to last user connection string, reason is static variable. There is any solutions.....please help me out Thanks Raj

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #2

      connection string are best stored in the web.config.

      Yusuf May I help you?

      V 1 Reply Last reply
      0
      • Y Yusuf

        connection string are best stored in the web.config.

        Yusuf May I help you?

        V Offline
        V Offline
        vnsraj
        wrote on last edited by
        #3

        Hi Yusuf, Thanks for reply. I know about web.config , but think is that there is website like shopping site, www.shopping.com but this website may have multiple database. DB-1, DB-2. But I don't know the database name and login details of database, its come through another database, After getting dbnam, userid, pwd I create connection string in class file. I will receive that value whole site. did you get my point

        N 1 Reply Last reply
        0
        • V vnsraj

          Hi Yusuf, Thanks for reply. I know about web.config , but think is that there is website like shopping site, www.shopping.com but this website may have multiple database. DB-1, DB-2. But I don't know the database name and login details of database, its come through another database, After getting dbnam, userid, pwd I create connection string in class file. I will receive that value whole site. did you get my point

          N Offline
          N Offline
          newc1
          wrote on last edited by
          #4

          Why don't you just store the connection string in a session variable, then it will be associated with each user and remain with them whilst they are logged in?

          Clean code is the key to happiness.

          1 Reply Last reply
          0
          • V vnsraj

            Hi Everyone, In my website when user login then I make connection string and store connection to the class in static variable. when user navigation different page in site I take connection string from class file and create connect to the DB. But my problem is that when another user login the first user connection string was change to last user connection string, reason is static variable. There is any solutions.....please help me out Thanks Raj

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            vnsraj wrote:

            But my problem is that when another user login the first user connection string was change to last user connection string,

            Can you please explain your business requirement, I am not able to understand that why connection of database changed based on user.:confused:

            cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

            modified on Friday, May 8, 2009 1:13 AM

            1 Reply Last reply
            0
            • V vnsraj

              Hi Everyone, In my website when user login then I make connection string and store connection to the class in static variable. when user navigation different page in site I take connection string from class file and create connect to the DB. But my problem is that when another user login the first user connection string was change to last user connection string, reason is static variable. There is any solutions.....please help me out Thanks Raj

              S Offline
              S Offline
              SayreCC
              wrote on last edited by
              #6

              Hi, try to check again your connstring: www.connectionstrings.com

              Hope this one can help. Thanks Hi, Please select Good Question if my answer are fit to your Question.

              1 Reply Last reply
              0
              • V vnsraj

                Hi Everyone, In my website when user login then I make connection string and store connection to the class in static variable. when user navigation different page in site I take connection string from class file and create connect to the DB. But my problem is that when another user login the first user connection string was change to last user connection string, reason is static variable. There is any solutions.....please help me out Thanks Raj

                P Offline
                P Offline
                Perry Holman
                wrote on last edited by
                #7

                Storing the connstring to Session is a good way so each user will hold his own connstring. Static variable is used at the Appliction level, which leads to your problem.

                Welcome to www.softwaretree.net! This website is generated completely by static html pages transforming technology. You can find many excellent audio/video tools there!

                1 Reply Last reply
                0
                • V vnsraj

                  Hi Everyone, In my website when user login then I make connection string and store connection to the class in static variable. when user navigation different page in site I take connection string from class file and create connect to the DB. But my problem is that when another user login the first user connection string was change to last user connection string, reason is static variable. There is any solutions.....please help me out Thanks Raj

                  E Offline
                  E Offline
                  EssamDev
                  wrote on last edited by
                  #8

                  hi the connection string will change to the last user why?because you put it in static variable it's means that this variable is shared for all users of application .so when any user assign it,it has only the last value. for example if we have static variable called x.the first user assign it by 5 .the second user assign it by 10. it becomes 10 not 5 . don't use static variable in this case. Essam

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups