locked
ASP.NET, SQL Server : problem in querying the database RRS feed

  • Question

  • User-560223997 posted

    I deployed my app, done in ASP.NET Core MVC, on the server, in IIS.

    However, an error appears when I pass the first screens of my app… It seems to be a problem in the querying of the database. Here is the error:

    """

    Hosting environment: Production
    Content root path: C:\My\MySitev1
    Now listening on: http://127.0.0.1:13624
    Application started. Press Ctrl+C to shut down.
    fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
    An unhandled exception has occurred while executing the request.
    System.Data.SqlClient.SqlException (0x80131904): Cannot resolve the collation co
    nflict between "Latin1_General_CI_AI" and "SQL_Latin1_General_CP1_CI_AI" in the
    like operation.
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolea
    n breakConnection, Action`1 wrapCloseInAction)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObj
    ect stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
    at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand
    cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,
    TdsParserStateObject stateObj, Boolean& dataReady)
    at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
    at System.Data.SqlClient.SqlDataReader.get_MetaData()
    at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, Run
    Behavior runBehavior, String resetOptionsString)
    at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBe
    havior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 time
    out, Task& task, Boolean asyncWrite, SqlDataReader ds)
    at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)

    """

    Is this in fact a problem in the querying of the database?

    What configuration should I change?

    Monday, February 3, 2020 12:38 PM

Answers

  • User77042963 posted

    Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "SQL_Latin1_General_CP1_CI_AI" in the like operation.

    Check your query for the LIKE keyword. You can try to change the collation at your query level to make both columns compatible in collation. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 3, 2020 3:02 PM