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. General Programming
  3. C#
  4. How to connect ASP.Net With SQL Server

How to connect ASP.Net With SQL Server

Scheduled Pinned Locked Moved C#
asp-nethelpcsharpdatabasesql-server
4 Posts 2 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
    dwark106
    wrote on last edited by
    #1

    I am new of ASP.Net and facing a problem that whenever I do connection ASP.Net with Sql Server it gives me error "Login failed for user 'ComputerName\ASPNET'. Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'ComputerName\ASPNET'. Line 78: thisAdapter.Fill(thisDataSet,"Customers"); I am doing like this " string myConnectionString = "Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;server=ComputerName\\MY2000"; thisConnection = new SqlConnection(myConnectionString); and so on. It is working fine in windows form. Thanks

    C 1 Reply Last reply
    0
    • D dwark106

      I am new of ASP.Net and facing a problem that whenever I do connection ASP.Net with Sql Server it gives me error "Login failed for user 'ComputerName\ASPNET'. Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'ComputerName\ASPNET'. Line 78: thisAdapter.Fill(thisDataSet,"Customers"); I am doing like this " string myConnectionString = "Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;server=ComputerName\\MY2000"; thisConnection = new SqlConnection(myConnectionString); and so on. It is working fine in windows form. Thanks

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      When you're using ASP.NET, you're working as the ASPNET user. That user needs to have the right to log in to SQL Server. The easiest way around is to log in with username/password instead of using Windows authentication. Christian Graus - Microsoft MVP - C++

      D 1 Reply Last reply
      0
      • C Christian Graus

        When you're using ASP.NET, you're working as the ASPNET user. That user needs to have the right to log in to SQL Server. The easiest way around is to log in with username/password instead of using Windows authentication. Christian Graus - Microsoft MVP - C++

        D Offline
        D Offline
        dwark106
        wrote on last edited by
        #3

        Thanks for your mail. I am doing like this string myConnectionString = "Initial Catalog=MyDB;Data Source=localhost;Integrated Security=SSPI;server=ComputerName\\MY2000;user id=sa; Password="; My password is blank. I am not using windows authentication. It is working without using ASP.NET.

        D 1 Reply Last reply
        0
        • D dwark106

          Thanks for your mail. I am doing like this string myConnectionString = "Initial Catalog=MyDB;Data Source=localhost;Integrated Security=SSPI;server=ComputerName\\MY2000;user id=sa; Password="; My password is blank. I am not using windows authentication. It is working without using ASP.NET.

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

          If I remove this "Integrated Security=SSPI;" from connecting string then It is working fine. Thanks a lot for your kind help.

          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