Login Failed for User


Author
Message
Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
The connection string manager connects to the database fine. When trying to launch our application the login fails. Here is an attachent of the error.
Attachments
SFQuote.ExceptionScreenShot.png (342 views, 127.00 KB)
Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
Oops wrong attachment. Here is the stack trace for the error :

Application Domain: SFQuote.vshost.exe

Assembly Codebase: file:///C:/SF/IMS/Win/SFQuote/SFQuote/bin/Debug/SFQuote.EXE

Assembly Full Name: SFQuote, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Assembly Version: 1.0.0.0

Assembly Build Date: 4/28/2006 12:09:29 PM

Exception Source: .Net SqlClient Data Provider

Exception Type: System.Data.SqlClient.SqlException

Exception Message: Login failed for user 'Test'.

Exception Target Site: OnError

---- Stack Trace ----

System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

SFQuote.EXE: N 735075

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

SFQuote.EXE: N 00188

System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

SFQuote.EXE: N 01838

System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)

SFQuote.EXE: N 00033

System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)

SFQuote.EXE: N 00628

System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)

SFQuote.EXE: N 00170

System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)

SFQuote.EXE: N 00359

System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)

SFQuote.EXE: N 00028

System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)

SFQuote.EXE: N 00424

System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)

SFQuote.EXE: N 00066

System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

SFQuote.EXE: N 00496

System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

SFQuote.EXE: N 00082

System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

SFQuote.EXE: N 00105

System.Data.SqlClient.SqlConnection.Open()

SFQuote.EXE: N 00111

System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

SFQuote.EXE: N 00121

System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)

SFQuote.EXE: N 00162

System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)

SFQuote.EXE: N 00107

MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack)

SFQuote.EXE: N 00097

MicroFour.StrataFrame.Data.SqlDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack)

SFQuote.EXE: N 00169

MicroFour.StrataFrame.Data.DataLayer.GetDataTable(DbCommand Command, Boolean RegisterNotification)

SFQuote.EXE: N 00105

MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(DbCommand CommandToExecute)

SFQuote.EXE: N 00034

IMS.BO.QuoteBOLib.SFUsersBO.FillByUserName(String vcUsername)

SFUsersBO.cs: line 0075, col 13, IL 0061

IMS.Win.SFQuote.frmUserLogin.LogInUser()

frmUserLogin.cs: line 0060, col 21, IL 0053

IMS.Win.SFQuote.AppMain.LogInUser()

AppMain.cs: line 0183, col 13, IL 0007

IMS.Win.SFQuote.AppMain.ShowLoginAndInitMainForm(ShowLoginAndInitFormEventArgs e)

AppMain.cs: line 0196, col 13, IL 0001

MicroFour.StrataFrame.Application.StrataFrameApplication.Raise_ShowLoginAndInitializeForm(ShowLoginAndInitFormEventArgs e)

SFQuote.EXE: N 00019


StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I'm not sure why this is failing other than it is possible that the username and password you entered might not be correct. When the wizard attempts to test the username and password, it just connects to the server, but doesn't attempt to connect to the database. You might make sure that the user "Test" has permission to connect to that database.



If that doesn't work, then you can put a call to ConnectionManager.ShowAvailableConnections() somewhere and this will pop up the dialog showing you the application connections so you can maintain them. Also, you can check the connection string that was generated by checking MicroFour.StrataFrame.Data.DataLayer.DataSources("").ConnectionString within the watch window... that might help.



If all else fails, you can delete the two *.dat files in the C:\Documents and Settings\All Users\Application Data\MicroFour\Connection Data\ folder... this will delete all of the stored connection strings on the computer and allow you to start over.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
One last thing that you can do to determine what connection string is being used immediately at the time of the SELECT so you can verify it is to put the data connection in debug mode. To do this add the following code after the SetConnections() method in the program.cs file:



MicroFour.StratraFrame.Data.DataBasics.DataSources("").DebugMode = true;



When you do this, a message window with all of the information that will be used during the SELECT will be displayed before it is executed. This is a great way to see what is going on. This is a very helpful tool.
Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
Looking at the connection string on the datasources collection it is correct. Using that string and creating a connection object, a data adapter, and command object I am able to fill a data table. During debuging I notice that the call to filldatatable on the business object sets the connection string of the passed in command object to the connection string minus the password. Here are the connection strings from both instances :

DataSources collection connection string: "Data Source=FILESERVER1;Initial Catalog=Quote;User ID=Test;Password=test;Asynchronous Processing=True"

Connection string of the command object after the call to filldatatable : Data Source=FILESERVER1;Initial Catalog=Quote;User ID=Test;Asynchronous Processing=True


StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
After you try to call FillDataTable on the business object, is the DataSource's connection string still correct? I'm not sure why it would be removing the password from the string, because this is the method we use to retrieve a new SqlConnection object within the SqlDataSourceItem class:



Public Overrides Function CreateBlankDbConnection() As System.Data.Common.DbConnection

'-- Return a new SqlConnection

Return New SqlConnection(Me.ConnectionString)

End Function



If we can figure out where the password is being removed from the connection string, then it might give us a clue.
Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
Here is the method where the code is failing.

public void FillByUserName(string vcUsername)

{

SqlCommand cmd = new SqlCommand();

cmd.CommandText = "SELECT * FROM Users WHERE UserName = @cUserName";

cmd.Parameters.Add("@cUserName",SqlDbType.VarChar);

cmd.Parameters["@cUserName"].Value = vcUsername;

FillDataTable(cmd);

}

MicroFour.StrataFrame.Data.DataLayer.DataSources["ServerConnection"].ConnectionString = "Data Source=FILESERVER1;Initial Catalog=Quote;User ID=Test;Password=test;Asynchronous Processing=True"

Setting a breakpoint after the FillDataTable command shows the following:

cmd.Connection.ConnectionString = "Data Source=FILESERVER1;Initial Catalog=Quote;User ID=Test;Asynchronous Processing=True"


Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
The code looks fines.  The error is coming from the SQL Server side.  Have you tried using the "sa" username and password to make sure that the "test" user isn't the problem with credentials.  The process of retrieving data is actually very simple and is out of our hands once it is handed off to SQL Server.

Were you able to connect to the StrataFrameSample database when going through the tutorial and is the StrataFrameSample database on the same server as the Quote database?

Sorry for all of the questions, but I am trying to figure out where it is failing on the server side.  Thanks.

Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
I don't believe the problem is on the server since I can connect through the management console as the user Test and perfom read and write operations through the query designer. It appears that the connection string which is assigned the the command object is missing the password after the call to FillDataTable. How can we use the source code in order to see exactly what is happening ?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You can open the solution to the source code, place the source code in Debug mode, and then build it. There is a .bat file that will register the DLLs in the GAC, and allow you to step into the framework methods, like FillDataTable. Then, you'll be able to watch the SqlCommand object as it is passed around and see where the password is being removed.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search