문제

SQL Server 2008 대신 MySQL 데이터베이스를 사용하도록 MVC3 응용 프로그램을 사용하려고합니다. MySQL에서 관련 데이터베이스와 개체를 만들었습니다.mysql.data.mysqlclient를 참조하여 my web.config 파일에서 연결 문자열을 업데이트했습니다.

응용 프로그램을 실행하고 로그인하려고하면 오류가 발생합니다

Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
.

나는 사용자 정의 멤버쉽을 가지고 있으며, 유효성 검사 프로세스 내에서 다음은 다음을 가지고있다

 using (MyContext context= new MyContext())
 {
      --some checks here
      ---
        if (verificationSucceeded)
        {
            user.passwordFailuresSinceLastSuccess = 0;
        }
        else
        {
            int failures = user.passwordFailuresSinceLastSuccess;
            if (failures != -1)
            {
                user.passwordFailuresSinceLastSuccess += 1;
                user.lastPasswordFailureDate = DateTime.UtcNow;
            }
        }
        context.SaveChanges();  ----THIS IS WHERE IT FALLS OVER
         -- some other code here 
    }
.

위의 코드는 SQL Server 2008에서 완벽하게 작동하지만 MySQL에서만 떨어지는 것입니다.내가 이것을 어떻게 해결할 수 있는지 알게 될까요?

기본 테이블 BTW에 정의 된 트리거가 없습니다.응용 프로그램은 먼저 EF 코드가있는 MVC3입니다. 고마워,

도움이 되었습니까?

해결책

다른 사람 이이 문제가있는 경우 문제는 그로 인해 GUID와 함께했습니다.이를 통해 연결 문자열에 다음을 추가하십시오.

이전 GUIDS= true

그래서, 예를 들어, 내 연결 문자열은 이제 다음과 같습니다.

<add name="MyDB" connectionString="Server=localhost; Database=mydatabase; Uid=user; Pwd=mypass; Old Guids=true;" providerName="MySql.Data.MySqlClient" />
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top