0

SQL Server に接続しようとしています。このコードを使用して

public static String getDBConnection()
    {
        SqlConnectionStringBuilder csBuilder = new SqlConnectionStringBuilder();

        csBuilder.InitialCatalog = "AdDatabase";
        csBuilder.DataSource = "JAWADAMJAD-PC\\SQLEXPRESS";
        csBuilder.UserID = "Jawad";
        csBuilder.Password = "123456";

         return csBuilder.ConnectionString;
    }

このユーザー名は、SQL Server 管理コンソールから追加しました。SQL Server に接続できない理由がまだわかりません。正常に接続するために他に何かする必要がありますか? もしそうなら、それは何ですか?助けてください!!!Visual Studio 2010 と SQL Server 2008 を使用しています。

次の例外が発生しています

    System.Data.SqlClient.SqlException: Login failed for user 'Jawad'.
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at AdServiceNew.Service1.initDB() in C:\Users\OZI TECH\Desktop\AdServiceNew\AdServiceNew\AdServiceNew\Service1.asmx.cs:line 57

私はSERVERログに行きました、そしてそれは言います

An attempt to login as SQL Authentication Failed. Server is configured for windows authentication only.
4

1 に答える 1