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. Database Connection in asp.net

Database Connection in asp.net

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netdatabase
9 Posts 5 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
    sarang_k
    wrote on last edited by
    #1

    Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.

    Y B S M 4 Replies Last reply
    0
    • S sarang_k

      Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.

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

      define the connection string in web.config under appsettigns tag like;

      <appsettigns>
      <add key="name" value"Data Source=remote pc name; uid=userid; password=sqlserverpassword;Initial Catalog=Database name"/>
      </appsettigns>

      </pre>

      or U can use the connection string tag also.

      call the same is ur cs or vb file using configuration managaer class.

      S 1 Reply Last reply
      0
      • S sarang_k

        Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.

        B Offline
        B Offline
        Brij
        wrote on last edited by
        #3

        sarang_k wrote:

        I want to connect that database to my application from that another system using the webconfig file.

        I didn't get you. What is the problem you facing to connect the db which in another system? define the connectionstring in web.config properly

        Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators

        1 Reply Last reply
        0
        • Y yogesh_kumar_agarwal

          define the connection string in web.config under appsettigns tag like;

          <appsettigns>
          <add key="name" value"Data Source=remote pc name; uid=userid; password=sqlserverpassword;Initial Catalog=Database name"/>
          </appsettigns>

          </pre>

          or U can use the connection string tag also.

          call the same is ur cs or vb file using configuration managaer class.

          S Offline
          S Offline
          sarang_k
          wrote on last edited by
          #4

          yes i have done using this but now the problem is when i am writing insert query it is not inserting the data into the database. But if i open sql server management studio and execute the query it is inserting. can u tell me how to solve it. Thanks in advance.

          Y 1 Reply Last reply
          0
          • S sarang_k

            yes i have done using this but now the problem is when i am writing insert query it is not inserting the data into the database. But if i open sql server management studio and execute the query it is inserting. can u tell me how to solve it. Thanks in advance.

            Y Offline
            Y Offline
            yogesh_kumar_agarwal
            wrote on last edited by
            #5

            Ok, then tell me the error. or if possible the show the code.

            S 1 Reply Last reply
            0
            • Y yogesh_kumar_agarwal

              Ok, then tell me the error. or if possible the show the code.

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

              there is no error. Main problem is it is not inserting in to the table.how to define the datasource of that another pc.can u give me an example or is there any thing we have to set properties or give access.And i am using sql server 2008. Thanks in advance.

              Y 1 Reply Last reply
              0
              • S sarang_k

                there is no error. Main problem is it is not inserting in to the table.how to define the datasource of that another pc.can u give me an example or is there any thing we have to set properties or give access.And i am using sql server 2008. Thanks in advance.

                Y Offline
                Y Offline
                yogesh_kumar_agarwal
                wrote on last edited by
                #7

                Nothing has to be define, If the problem is in insert query the connection has no problem. it will be inserted in the same manner it inserts with the local database. just define the connection in your command statement SqlCommand sql=new SqlCommand(str,con) will work fine. Or check with ur user credential for login into sql database. sa has right and the other user not then also the insert could be failed.

                1 Reply Last reply
                0
                • S sarang_k

                  Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.

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

                  first check the database tht if you can access from your system using sqlserver management studio. If yes There will be no problem just specify the correct connect string as brij suggested.

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

                  1 Reply Last reply
                  0
                  • S sarang_k

                    Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.

                    M Offline
                    M Offline
                    meeram395
                    wrote on last edited by
                    #9

                    You may select, insert or update the queries in the Sql Server Management Studio, but not from the application. Just check whether the application is having right access to do the manipulations in db. This might be the problem, even though the connection string is correct.

                    Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

                    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