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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. connectionStrings

connectionStrings

Scheduled Pinned Locked Moved ASP.NET
help
7 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.
  • S Offline
    S Offline
    SaharMoj
    wrote on last edited by
    #1

    i need help with this subject. i want to set connectionString in web.config. don`t know how!

    J V M A P 6 Replies Last reply
    0
    • S SaharMoj

      i need help with this subject. i want to set connectionString in web.config. don`t know how!

      J Offline
      J Offline
      John ph
      wrote on last edited by
      #2

      http://www.dotnetjohn.com/articles.aspx?articleid=3[^]

      Regards
      J O H N :rose:
      "Even eagles need a push." David McNally


      1 Reply Last reply
      0
      • S SaharMoj

        i need help with this subject. i want to set connectionString in web.config. don`t know how!

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #3

        http://msdn2.microsoft.com/en-us/library/ms178411.aspx[^]

        Vasudevan Deepak Kumar Personal Homepage Tech Gossips

        1 Reply Last reply
        0
        • S SaharMoj

          i need help with this subject. i want to set connectionString in web.config. don`t know how!

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          ASP.NET 1.1

          <appSettings>
          <add key="ConnectionInfo" value="server=(local);database=Northwind;Integrated Security=SSPI" />
          </appSettings>

          Reading this string from code ~ ConfigurationSettings.AppSettings["ConnectionInfo"]; ASP.NET 2.0,

          <connectionStrings>
          <add name="YourConnectionString" connectionString="Data Source=YourSQLServer; Initial Catalog=YourDatabase; User ID=YourUserID; Password=YourPassword" providerName="System.Data.SqlClient" />
          </connectionStrings>

          Reading this string from code ~ if (((ConfigurationManager.ConnectionStrings("YourConnectionString") == null) || _)) { ConfigurationManager.ConnectionStrings("YourConnectionString").ConnectionString.Trim() = ""; throw new Exception("Connection Error"); } else { conn.ConnectionString = ConfigurationManager.ConnectionStrings("YourConnectionString").ConnectionString; }

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

          1 Reply Last reply
          0
          • S SaharMoj

            i need help with this subject. i want to set connectionString in web.config. don`t know how!

            A Offline
            A Offline
            Ahmad Adnan
            wrote on last edited by
            #5

            if u mean that u wanto to edit the ConnectionString within the code(Dynamiclay) u couldn't only by the web configuration tool or manual regrds

            1 Reply Last reply
            0
            • S SaharMoj

              i need help with this subject. i want to set connectionString in web.config. don`t know how!

              P Offline
              P Offline
              Paul Conrad
              wrote on last edited by
              #6

              Add www.connectionstrings.com[^] to your bookmark. It is very helpful and can be of use if you work with numerous different databases.

              "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

              1 Reply Last reply
              0
              • S SaharMoj

                i need help with this subject. i want to set connectionString in web.config. don`t know how!

                A Offline
                A Offline
                Abolfazl Sheikhloo
                wrote on last edited by
                #7

                salam kheyli khoshhal shodam ke tedade iraniha dar in talar har ruz bishtar mishe. va amma moshkele shoma: shoma mitavanid dar file web.config yek klid mesle: ijad konid , jahate estefade az an: private SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connectionName"]); dar har gesmat az code garar dahid. dar zemn behtare ruye foldere Bin right click karde va componente System.Configuration ra add konid. My Real Email: abolfazl585@yahoo.com We Can Do Anything, If We Want It

                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