Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

System.Data.SqlClient.SqlException: Login failed for user

$
0
0

This project was working fine.

The hard drive was going out on my development PC, so I swapped in a new one, reloaded my data, installed SQL Express, loaded my database, and tried running the project.

The form uses SQL authentication, and I have the username and password listed in the connection string and the user is added to the list of users in the database.

I still can't get this to work!

Server Error in '/' Application.


Login failed for user 'mcl959_admin'.

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 'mcl959_admin'.

Source Error:

Line 169:                try
Line 170:                {
Line 171: con.Open();
Line 172:                    var roster = new DataTable();
Line 173:                    using (var cmd = new SqlCommand("SELECT * FROM [dbo].[Roster]; ", con))

Source File: C:\Users\jp2code\Box Sync\SmarterAsp\jp2code-001\mcl959\Classes\SqlBuilder.cs   Line:171

Stack Trace:

[SqlException (0x80131904): Login failed for user 'mcl959_admin'.]
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +347
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +191
   System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +154
   System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +21
   System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +90
   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +217
   System.Data.SqlClient.SqlConnection.Open() +96
   mcl959.SqlTool.GetPersonnel() in C:\Users\jp2code\Box Sync\SmarterAsp\jp2code-001\mcl959\Classes\SqlBuilder.cs:171
   mcl959.Personnel.PersonnelDataSource(String databaseConnection) in C:\Users\jp2code\Box Sync\SmarterAsp\jp2code-001\mcl959\Classes\Personnel.cs:387
   mcl959.Member.Page_Load(Object sender, EventArgs e) in C:\Users\jp2code\Box Sync\SmarterAsp\jp2code-001\mcl959\Member.aspx.cs:37
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0

Here is the SQL to replicate the user:

CREATE LOGIN [mcl959_admin] WITH
 PASSWORD=N'PLXNWcPJI2UDoC7KPKDfHIrUngyb1/81BwUnCa+aA4g=',
 DEFAULT_DATABASE=[master],
 DEFAULT_LANGUAGE=[us_english],
 CHECK_EXPIRATION=OFF,
 CHECK_POLICY=ON


Here are some related sections of my Web.config file:

<add name="LOCALD630" connectionString="Data Source=D630-PC\SQLEXPRESS;Initial Catalog=DB_9CF886_mcl959;User Id=mcl959_admin;Password=i_altered_this" providerName="System.Data.SqlClient" /><system.web><authentication mode="None"></authentication><customErrors mode="Off" /><compilation debug="true" targetFramework="4.6" /><httpRuntime targetFramework="4.6" requestPathInvalidCharacters="&lt;,&gt;,*,%,&amp;,:,\,?" /></system.web>


Could someone PLEASE help me?

This is a free job that I do for a local non-profit organization. Though I do not get much time each day to spend on it, I have been struggling with this for almost a week now. I am no closer to resolving this than when I first got the error.


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>