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. how to write connection string for two databases in asp.net with c#

how to write connection string for two databases in asp.net with c#

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasetutorialasp-net
8 Posts 4 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.
  • D Offline
    D Offline
    developerit
    wrote on last edited by
    #1

    from one sqlsever2000 i have two database employeedb and companydb .how to create the connection string for this using asp.net with c#. give me simple example not a query.

    S R K 3 Replies Last reply
    0
    • D developerit

      from one sqlsever2000 i have two database employeedb and companydb .how to create the connection string for this using asp.net with c#. give me simple example not a query.

      S Offline
      S Offline
      sashidhar
      wrote on last edited by
      #2

      developerit wrote:

      from one sqlsever2000 i have two database employeedb and companydb

      You have to create 2 connection strings in web.config file..! or if You have to use it in code get the data source dynamically. but its a bad idea to give connection string in code..! Here is a link for connection strings..! http://www.connectionstrings.com/[^]

      LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

      D 1 Reply Last reply
      0
      • D developerit

        from one sqlsever2000 i have two database employeedb and companydb .how to create the connection string for this using asp.net with c#. give me simple example not a query.

        R Offline
        R Offline
        R Giskard Reventlov
        wrote on last edited by
        #3

        You already asked this and got a good answer. Did you not understand the answers?

        Tychotics: take us back to the moon "Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars." H. G. Wells

        D 1 Reply Last reply
        0
        • R R Giskard Reventlov

          You already asked this and got a good answer. Did you not understand the answers?

          Tychotics: take us back to the moon "Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars." H. G. Wells

          D Offline
          D Offline
          developerit
          wrote on last edited by
          #4

          before the community was posted is the querry but i want the connection string for two database using asp.net with c#, can you give a simple example

          R 1 Reply Last reply
          0
          • D developerit

            from one sqlsever2000 i have two database employeedb and companydb .how to create the connection string for this using asp.net with c#. give me simple example not a query.

            K Offline
            K Offline
            ksss_maheshece
            wrote on last edited by
            #5

            why do u use 2 connection strings. U create a login which has the access of two databases.and mention the login in your connection string.

            1 Reply Last reply
            0
            • S sashidhar

              developerit wrote:

              from one sqlsever2000 i have two database employeedb and companydb

              You have to create 2 connection strings in web.config file..! or if You have to use it in code get the data source dynamically. but its a bad idea to give connection string in code..! Here is a link for connection strings..! http://www.connectionstrings.com/[^]

              LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

              D Offline
              D Offline
              developerit
              wrote on last edited by
              #6

              the site http://www.connectrings.com is giving idea for single connection string....i want for two connection string, can you give simple example

              S 1 Reply Last reply
              0
              • D developerit

                the site http://www.connectrings.com is giving idea for single connection string....i want for two connection string, can you give simple example

                S Offline
                S Offline
                sashidhar
                wrote on last edited by
                #7

                developerit wrote:

                i want for two connection string,

                What do u mean by tht..! You need to add 2 connection strings in web.config file..!

                <appSettings> <add key="connectionString1" value="User Id=User ID;password=XXXX;Initial Catalog=company;Data Source=Name;Packet Size=4096"/>
                <add key="connectionString2" value="User Id=User ID;password=XXXX;Initial Catalog=employee;Data Source=Name;Packet Size=4096"/> </appSettings>

                Then If u want to call thr code..!if u want to call first connection string specify the name in the value like ConnectionString1/Connectionstring2 ConfigurationSettings.AppSettings["ConnectionString1"]; ConfigurationSettings.AppSettings["ConnectionString2"];

                LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

                1 Reply Last reply
                0
                • D developerit

                  before the community was posted is the querry but i want the connection string for two database using asp.net with c#, can you give a simple example

                  R Offline
                  R Offline
                  R Giskard Reventlov
                  wrote on last edited by
                  #8

                  If you can't get it form all the information you have been given you are in the wrong job. Read through all of the posts again: it is all there.

                  Tychotics: take us back to the moon "Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars." H. G. Wells

                  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