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. connecting Sqlserver2000 with ASP.net(C#)

connecting Sqlserver2000 with ASP.net(C#)

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netdatabasesysadmin
3 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.
  • C Offline
    C Offline
    cishi_us
    wrote on last edited by
    #1

    hi all; I am trying to connect sql server2000 with asp.net(C#). but nothing happens. Actual problem comming from connection string which is not coming to solve my code is as follow: <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Page language="C#" %> void Page_Load() { string my="workstation id=HOME;packet size=4096;integrated security=SSPI;data source=HOME;persist security info=False;initial catalog=PrintQuota"; SqlConnection mycon=new SqlConnection(my); try { mycon.Open(); TextBox1.Text="Connection opend successfully"; mycon.Close(); } catch (Exception g) { TextBox1.Text=g.ToString(); } } The main problem is with user id and password,, i have also checked with integrated security=SSPI but no way to connect..the same string i use in window application but its work but here in web app its not working error message from exception is error System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at ASP.UserInfo_aspx.Page_Load() in http://localhost/WebApplication1/UserInfo.aspx:line 16 plz solve my problem . i m waiting for replies. with regards Ishtiaq

    P 1 Reply Last reply
    0
    • C cishi_us

      hi all; I am trying to connect sql server2000 with asp.net(C#). but nothing happens. Actual problem comming from connection string which is not coming to solve my code is as follow: <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Page language="C#" %> void Page_Load() { string my="workstation id=HOME;packet size=4096;integrated security=SSPI;data source=HOME;persist security info=False;initial catalog=PrintQuota"; SqlConnection mycon=new SqlConnection(my); try { mycon.Open(); TextBox1.Text="Connection opend successfully"; mycon.Close(); } catch (Exception g) { TextBox1.Text=g.ToString(); } } The main problem is with user id and password,, i have also checked with integrated security=SSPI but no way to connect..the same string i use in window application but its work but here in web app its not working error message from exception is error System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at ASP.UserInfo_aspx.Page_Load() in http://localhost/WebApplication1/UserInfo.aspx:line 16 plz solve my problem . i m waiting for replies. with regards Ishtiaq

      P Offline
      P Offline
      parsiphal
      wrote on last edited by
      #2

      Hi there, make bold this line: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Here you see the user is not which you expect. It is because your WebApplication is executed by the wrong user. You should use the "impersonate" mechanism (in the we.config) to make the application run with your user. Depending on which Operative System you are using, it can be also accomplished by changing the user with wich runs ASP.NET process or the ApplicationPool (IIS 6, win2003). Another way is to make the application impersonate the user which causes the session to init. These all are configuration issues you can find in Microsoft MSDN and TecNet, and more places all abroad Internet. Hope this help, Parsiphal

      C 1 Reply Last reply
      0
      • P parsiphal

        Hi there, make bold this line: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Here you see the user is not which you expect. It is because your WebApplication is executed by the wrong user. You should use the "impersonate" mechanism (in the we.config) to make the application run with your user. Depending on which Operative System you are using, it can be also accomplished by changing the user with wich runs ASP.NET process or the ApplicationPool (IIS 6, win2003). Another way is to make the application impersonate the user which causes the session to init. These all are configuration issues you can find in Microsoft MSDN and TecNet, and more places all abroad Internet. Hope this help, Parsiphal

        C Offline
        C Offline
        cishi_us
        wrote on last edited by
        #3

        well sir i got yours point ..i am using windows 2003 server as operating system..wat i have to do to connect the database (sql server200) in asp.net. plz tell me the steps that which code of lines should be written where???or wat i do with theuser etc plz help me in some way. With best wishes Ishtiaq Ahmed

        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