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. ASP .NET and SQL server connection Error

ASP .NET and SQL server connection Error

Scheduled Pinned Locked Moved ASP.NET
helpdatabasecsharpsql-serversysadmin
5 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.
  • J Offline
    J Offline
    Jmshastri
    wrote on last edited by
    #1

    I am having Error while connecting to the SQL server database in ASP .NET application. The database server is on a remote pc. the code snipet that has error is shown below: Line 42: Dim cmd As New SqlClient.SqlCommand Line 43: con.ConnectionString = cstrg Line 44: con.Open() Line 45: cmd.Connection = con The Error Msg is: "SQL Server does not exist or Access Denied " Please tell me that what content of Web.Config file should I specify to connect successfully if the database server is named as BHAVIK and Database is named as ASP The portion of current web.config file is shown below:

    Please help me out in this problem. Jwalant

    C I 2 Replies Last reply
    0
    • J Jmshastri

      I am having Error while connecting to the SQL server database in ASP .NET application. The database server is on a remote pc. the code snipet that has error is shown below: Line 42: Dim cmd As New SqlClient.SqlCommand Line 43: con.ConnectionString = cstrg Line 44: con.Open() Line 45: cmd.Connection = con The Error Msg is: "SQL Server does not exist or Access Denied " Please tell me that what content of Web.Config file should I specify to connect successfully if the database server is named as BHAVIK and Database is named as ASP The portion of current web.config file is shown below:

      Please help me out in this problem. Jwalant

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      The web.config snippet is not showing up because it is treating the XML tags as HTML and the browser cannot render those. You need to escape the angle brackets < == < Also, it would be useful to know what the connection string is. You don't show that - unless it was in the web.config and we just can't see it. ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?

      J 1 Reply Last reply
      0
      • C Colin Angus Mackay

        The web.config snippet is not showing up because it is treating the XML tags as HTML and the browser cannot render those. You need to escape the angle brackets < == < Also, it would be useful to know what the connection string is. You don't show that - unless it was in the web.config and we just can't see it. ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?

        J Offline
        J Offline
        Jmshastri
        wrote on last edited by
        #3

        the connectionstring is: "Server=BHAVIK;Database=ASPDB;Integrated Security Info=SSPI" This is the connectionstring that I apply in the web.config file. the portion of web config file is shown below: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="cs" value="Server=BHAVIK;Database=ASPDB;Integrated Security Info=SSPI" /> </appSettings> Do i need to change it or not?

        L 1 Reply Last reply
        0
        • J Jmshastri

          the connectionstring is: "Server=BHAVIK;Database=ASPDB;Integrated Security Info=SSPI" This is the connectionstring that I apply in the web.config file. the portion of web config file is shown below: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="cs" value="Server=BHAVIK;Database=ASPDB;Integrated Security Info=SSPI" /> </appSettings> Do i need to change it or not?

          L Offline
          L Offline
          lavanya thadde
          wrote on last edited by
          #4

          Also include Username and Password and then try sdfsdfsdfsdf

          1 Reply Last reply
          0
          • J Jmshastri

            I am having Error while connecting to the SQL server database in ASP .NET application. The database server is on a remote pc. the code snipet that has error is shown below: Line 42: Dim cmd As New SqlClient.SqlCommand Line 43: con.ConnectionString = cstrg Line 44: con.Open() Line 45: cmd.Connection = con The Error Msg is: "SQL Server does not exist or Access Denied " Please tell me that what content of Web.Config file should I specify to connect successfully if the database server is named as BHAVIK and Database is named as ASP The portion of current web.config file is shown below:

            Please help me out in this problem. Jwalant

            I Offline
            I Offline
            Ista
            wrote on last edited by
            #5

            If your using SSPI you dont need user name & password Navigate inside server explorer to a table inside your database and drag that onto your web form. Then go inside your code and copy the connection string that was built and paste it inside your web.config file It will work then 1 line of code equals many bugs. So don't write any!!

            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