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. pass connection string in user control

pass connection string in user control

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasequestion
7 Posts 3 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.
  • R Offline
    R Offline
    ravihd
    wrote on last edited by
    #1

    Hi How do i pass sql connectionstring as parameter in asp.net user control Thanks in Advance

    _ 1 Reply Last reply
    0
    • R ravihd

      Hi How do i pass sql connectionstring as parameter in asp.net user control Thanks in Advance

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      Hi, Put it in web.config file under appsettings and use it whereever you want in your application. Hope this will solve the problem. Best Regards, Apurva Kaushal

      S 1 Reply Last reply
      0
      • _ _AK_

        Hi, Put it in web.config file under appsettings and use it whereever you want in your application. Hope this will solve the problem. Best Regards, Apurva Kaushal

        S Offline
        S Offline
        sharma rajkumar
        wrote on last edited by
        #3

        You can write code in web.config as then in user control write namespace using System.Configuration and then u can write code witten below where you want to access connection as ConfigurationSetting(appSettings[con]); rajkumar Sharma

        R 1 Reply Last reply
        0
        • S sharma rajkumar

          You can write code in web.config as then in user control write namespace using System.Configuration and then u can write code witten below where you want to access connection as ConfigurationSetting(appSettings[con]); rajkumar Sharma

          R Offline
          R Offline
          ravihd
          wrote on last edited by
          #4

          Actualy i would like to pass connection string from aspx page to user control.

          _ S 2 Replies Last reply
          0
          • R ravihd

            Actualy i would like to pass connection string from aspx page to user control.

            _ Offline
            _ Offline
            _AK_
            wrote on last edited by
            #5

            Hi, You can create a public property and then you can access through that. Best Regards, Apurva Kaushal

            R 1 Reply Last reply
            0
            • R ravihd

              Actualy i would like to pass connection string from aspx page to user control.

              S Offline
              S Offline
              sharma rajkumar
              wrote on last edited by
              #6

              then Use Session Object as Session["conection"]="Connectionstring"; and in user coontrol u can retrieve it by string x=Session["conection"].ToString(); rajkumar Sharma

              1 Reply Last reply
              0
              • _ _AK_

                Hi, You can create a public property and then you can access through that. Best Regards, Apurva Kaushal

                R Offline
                R Offline
                ravihd
                wrote on last edited by
                #7

                Thanks for ur prompt reply

                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