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. Problems with database connections

Problems with database connections

Scheduled Pinned Locked Moved ASP.NET
databasehtmlasp-netsysadmindata-structures
4 Posts 3 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.
  • P Offline
    P Offline
    Pang Chen
    wrote on last edited by
    #1

    I'm trying to connect to a sql database but it seems whenever i open the connection, an exception will be thrown. The same code for accessing the database worked very well in a windows application, and i have also tried some other types of connections including an oledb connection to an Access database file. None of them succeeded. The exception looks like this:

    Server Error in '/interdev' Application.


    Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.

    Source Error:

    Line 15: // Create and fill a DataSet. Line 16: DataSet ds = new DataSet(); Line 17: myCommand.Fill(ds); Line 18: // Bind MyDataGrid to the DataSet. MyDataGrid is the ID for the Line 19: // DataGrid control in the HTML section.
    Source File: D:\Develop\Servers\interdev\test.aspx    Line: 17

    Stack Trace:

    [SqlException: Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) System.Data.SqlClient.SqlConnection.Open() System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) ASP.Test_aspx.Page_Load(Object Src, EventArgs E) in D:\Dev

    T Z 2 Replies Last reply
    0
    • P Pang Chen

      I'm trying to connect to a sql database but it seems whenever i open the connection, an exception will be thrown. The same code for accessing the database worked very well in a windows application, and i have also tried some other types of connections including an oledb connection to an Access database file. None of them succeeded. The exception looks like this:

      Server Error in '/interdev' Application.


      Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.

      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

      Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.

      Source Error:

      Line 15: // Create and fill a DataSet. Line 16: DataSet ds = new DataSet(); Line 17: myCommand.Fill(ds); Line 18: // Bind MyDataGrid to the DataSet. MyDataGrid is the ID for the Line 19: // DataGrid control in the HTML section.
      Source File: D:\Develop\Servers\interdev\test.aspx    Line: 17

      Stack Trace:

      [SqlException: Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) System.Data.SqlClient.SqlConnection.Open() System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) ASP.Test_aspx.Page_Load(Object Src, EventArgs E) in D:\Dev

      T Offline
      T Offline
      Thea Burger
      wrote on last edited by
      #2

      Try adding the 'ECHEVIL-LAPTOP\ASPNET' user account to your database. In Enterprise Manager, open your Sql Server Groups --> open the security folder --> right-click Logins --> New Login --> Browse to your 'ECHEVIL-LAPTOP\ASPNET' and select it. Then on the Database Access tab, select your database which you want to access and check the public and db_datareader roles. HTH, Thea

      1 Reply Last reply
      0
      • P Pang Chen

        I'm trying to connect to a sql database but it seems whenever i open the connection, an exception will be thrown. The same code for accessing the database worked very well in a windows application, and i have also tried some other types of connections including an oledb connection to an Access database file. None of them succeeded. The exception looks like this:

        Server Error in '/interdev' Application.


        Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.

        Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

        Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.

        Source Error:

        Line 15: // Create and fill a DataSet. Line 16: DataSet ds = new DataSet(); Line 17: myCommand.Fill(ds); Line 18: // Bind MyDataGrid to the DataSet. MyDataGrid is the ID for the Line 19: // DataGrid control in the HTML section.
        Source File: D:\Develop\Servers\interdev\test.aspx    Line: 17

        Stack Trace:

        [SqlException: Login failed for user 'ECHEVIL-LAPTOP\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) System.Data.SqlClient.SqlConnection.Open() System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) ASP.Test_aspx.Page_Load(Object Src, EventArgs E) in D:\Dev

        Z Offline
        Z Offline
        ZimCoder
        wrote on last edited by
        #3

        Your problem has to do with authentication and permissions for access to your SQL server instance. Try the sa account without the password in you connection string by the way did you use wizards in creating your adapter or did you type in the connection string yourself?? zimcoder What Democracy?? Jesus Christ is King and if you do not like... well you can go to hell!

        P 1 Reply Last reply
        0
        • Z ZimCoder

          Your problem has to do with authentication and permissions for access to your SQL server instance. Try the sa account without the password in you connection string by the way did you use wizards in creating your adapter or did you type in the connection string yourself?? zimcoder What Democracy?? Jesus Christ is King and if you do not like... well you can go to hell!

          P Offline
          P Offline
          Pang Chen
          wrote on last edited by
          #4

          I tried the wizard and i also wrote some connection strings myself. by the way i'm using MS Deskop Engine as the data source, and i only want to make it work on my machine. would it be quite different from a full version SQL server? 'cause the sa account does not work even in a windows application.

          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