Connection to SQL Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dejan Lazic

    #1

    Connection to SQL Server

    Why can't I connect to my SQL database using ASP.NET
    (VB.NET) and ADO.NET?
    I get the following error:

    System.Data.Sql Client.SqlExcep tion: Login failed for
    user 'DEJO\ASPNET'. at
    System.Data.Sql Client.Connecti onPool.GetConne ction
    (Boolean& isInTransaction ) at
    System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledCon
    nection(SqlConn ectionString options, Boolean&
    isInTransaction ) at
    System.Data.Sql Client.SqlConne ction.Open() at
    MyWebSite.WebFo rm2.Page_Load(O bject sender,
    EventArgs e) in C:\Documents and
    Settings\Dejan\ VSWebCache\DEJO \MyWebSite\WebF orm2.aspx.vb:l
    ine 29

    My connection is:
    Imports System.Data.Sql Client
    --
    Const DBString As String = "Integrated
    Security=SSPI;I nitial Catalog=Northwi nd;Data Source=
    (local)"
    Dim cnn As New SqlConnection(D BString)
    cnn.Open()

    I use VS.NET 2003, Windows XP SP1, computer's name is
    DEJO, SQL Server 2000 is on local computer.
    I tried with both permission settings, "Use same
    permissions as the root Web server"
    and "Use unique permissions for this Web application".

    What (Where) do I have to set up?
    Thanks in advance.


  • Dejan Lazic

    #2
    Re: Connection to SQL Server

    Thank you Marc, I'll try.
    Can I change the name of the account (ASPNET)?
    [color=blue]
    >-----Original Message-----
    >Hi,
    >
    >I assume that the account 'DEJO\ASPNET' which ASP.NET [/color]
    uses on your computer[color=blue]
    >has no security rights on the SQL server. You can add [/color]
    this account to SQL[color=blue]
    >Server using the Enterprise Management Console and give [/color]
    it the necessary[color=blue]
    >rights to work with the DB you are selecting.
    >
    >Best regards,
    >
    >Marc Höppner
    >NeoGeo
    >
    >"Dejan Lazic" <dejan.lazic@os .hinet.hr> wrote in message
    >news:97d701c35 bf6$cc5cc4a0$a0 01280a@phx.gbl. ..[color=green]
    >> Why can't I connect to my SQL database using ASP.NET
    >> (VB.NET) and ADO.NET?
    >> I get the following error:
    >>
    >> System.Data.Sql Client.SqlExcep tion: Login failed for
    >> user 'DEJO\ASPNET'. at
    >> System.Data.Sql Client.Connecti onPool.GetConne ction
    >> (Boolean& isInTransaction ) at
    >> [/color][/color]
    System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledCon[color=blue][color=green]
    >> nection(SqlConn ectionString options, Boolean&
    >> isInTransaction ) at
    >> System.Data.Sql Client.SqlConne ction.Open() at
    >> MyWebSite.WebFo rm2.Page_Load(O bject sender,
    >> EventArgs e) in C:\Documents and
    >> [/color][/color]
    Settings\Dejan\ VSWebCache\DEJO \MyWebSite\WebF orm2.aspx.vb:l[color=blue][color=green]
    >> ine 29
    >>
    >> My connection is:
    >> Imports System.Data.Sql Client
    >> --
    >> Const DBString As String = "Integrated
    >> Security=SSPI;I nitial Catalog=Northwi nd;Data Source=
    >> (local)"
    >> Dim cnn As New SqlConnection(D BString)
    >> cnn.Open()
    >>
    >> I use VS.NET 2003, Windows XP SP1, computer's name is
    >> DEJO, SQL Server 2000 is on local computer.
    >> I tried with both permission settings, "Use same
    >> permissions as the root Web server"
    >> and "Use unique permissions for this Web application".
    >>
    >> What (Where) do I have to set up?
    >> Thanks in advance.
    >>
    >>[/color]
    >
    >
    >.
    >[/color]

    Comment

    • Dejan Lazic

      #3
      Re: Connection to SQL Server

      Yes, it works perfectly.
      I was confused because the same connetion
      worked well in VB.NET. I just learn ASP.NET.
      Thank you.
      [color=blue]
      >-----Original Message-----
      >Hi,
      >
      >I assume that the account 'DEJO\ASPNET' which ASP.NET [/color]
      uses on your computer[color=blue]
      >has no security rights on the SQL server. You can add [/color]
      this account to SQL[color=blue]
      >Server using the Enterprise Management Console and give [/color]
      it the necessary[color=blue]
      >rights to work with the DB you are selecting.
      >
      >Best regards,
      >
      >Marc Höppner
      >NeoGeo
      >
      >"Dejan Lazic" <dejan.lazic@os .hinet.hr> wrote in message
      >news:97d701c35 bf6$cc5cc4a0$a0 01280a@phx.gbl. ..[color=green]
      >> Why can't I connect to my SQL database using ASP.NET
      >> (VB.NET) and ADO.NET?
      >> I get the following error:
      >>
      >> System.Data.Sql Client.SqlExcep tion: Login failed for
      >> user 'DEJO\ASPNET'. at
      >> System.Data.Sql Client.Connecti onPool.GetConne ction
      >> (Boolean& isInTransaction ) at
      >> [/color][/color]
      System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledCon[color=blue][color=green]
      >> nection(SqlConn ectionString options, Boolean&
      >> isInTransaction ) at
      >> System.Data.Sql Client.SqlConne ction.Open() at
      >> MyWebSite.WebFo rm2.Page_Load(O bject sender,
      >> EventArgs e) in C:\Documents and
      >> [/color][/color]
      Settings\Dejan\ VSWebCache\DEJO \MyWebSite\WebF orm2.aspx.vb:l[color=blue][color=green]
      >> ine 29
      >>
      >> My connection is:
      >> Imports System.Data.Sql Client
      >> --
      >> Const DBString As String = "Integrated
      >> Security=SSPI;I nitial Catalog=Northwi nd;Data Source=
      >> (local)"
      >> Dim cnn As New SqlConnection(D BString)
      >> cnn.Open()
      >>
      >> I use VS.NET 2003, Windows XP SP1, computer's name is
      >> DEJO, SQL Server 2000 is on local computer.
      >> I tried with both permission settings, "Use same
      >> permissions as the root Web server"
      >> and "Use unique permissions for this Web application".
      >>
      >> What (Where) do I have to set up?
      >> Thanks in advance.
      >>
      >>[/color]
      >
      >
      >.
      >[/color]

      Comment

      • Marc Hoeppner

        #4
        Re: Connection to SQL Server

        Yes, you can change the machine.config which is in the
        microsoft.net/framework/ under winnt or windows on your hard drive.

        http://support.microsoft.com/default...b;en-us;315158

        "Dejan Lazic" <dejan.lazic@os .hinet.hr> wrote in message
        news:07f601c35b fc$ecefa380$a60 1280a@phx.gbl.. .
        Thank you Marc, I'll try.
        Can I change the name of the account (ASPNET)?
        [color=blue]
        >-----Original Message-----
        >Hi,
        >
        >I assume that the account 'DEJO\ASPNET' which ASP.NET[/color]
        uses on your computer[color=blue]
        >has no security rights on the SQL server. You can add[/color]
        this account to SQL[color=blue]
        >Server using the Enterprise Management Console and give[/color]
        it the necessary[color=blue]
        >rights to work with the DB you are selecting.
        >
        >Best regards,
        >
        >Marc Höppner
        >NeoGeo
        >
        >"Dejan Lazic" <dejan.lazic@os .hinet.hr> wrote in message
        >news:97d701c35 bf6$cc5cc4a0$a0 01280a@phx.gbl. ..[color=green]
        >> Why can't I connect to my SQL database using ASP.NET
        >> (VB.NET) and ADO.NET?
        >> I get the following error:
        >>
        >> System.Data.Sql Client.SqlExcep tion: Login failed for
        >> user 'DEJO\ASPNET'. at
        >> System.Data.Sql Client.Connecti onPool.GetConne ction
        >> (Boolean& isInTransaction ) at
        >>[/color][/color]
        System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledCon[color=blue][color=green]
        >> nection(SqlConn ectionString options, Boolean&
        >> isInTransaction ) at
        >> System.Data.Sql Client.SqlConne ction.Open() at
        >> MyWebSite.WebFo rm2.Page_Load(O bject sender,
        >> EventArgs e) in C:\Documents and
        >>[/color][/color]
        Settings\Dejan\ VSWebCache\DEJO \MyWebSite\WebF orm2.aspx.vb:l[color=blue][color=green]
        >> ine 29
        >>
        >> My connection is:
        >> Imports System.Data.Sql Client
        >> --
        >> Const DBString As String = "Integrated
        >> Security=SSPI;I nitial Catalog=Northwi nd;Data Source=
        >> (local)"
        >> Dim cnn As New SqlConnection(D BString)
        >> cnn.Open()
        >>
        >> I use VS.NET 2003, Windows XP SP1, computer's name is
        >> DEJO, SQL Server 2000 is on local computer.
        >> I tried with both permission settings, "Use same
        >> permissions as the root Web server"
        >> and "Use unique permissions for this Web application".
        >>
        >> What (Where) do I have to set up?
        >> Thanks in advance.
        >>
        >>[/color]
        >
        >
        >.
        >[/color]


        Comment

        Working...