asp.net mvc 3 - MySql with MVC3 gives an error when calling context.savechanges -
i'm trying mvc3 application use mysql database instead of sql server 2008. have created associated database , objects in mysql. , updated connection string in web.config file reference mysql.data.mysqlclient.
when run application , try login, getting error
store update, insert, or delete statement affected unexpected number of rows (0). entities may have been modified or deleted since entities loaded. refresh objectstatemanager entries.
i have custom membershipprovider , within validation process have following
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 falls on -- other code here }
the above code works sql server 2008, falling on mysql. idea how can resolve please?
i not have triggers defined on underlying table btw. application mvc3 ef code first. thanks,
if else having issue, problem guid though. on this, add following connection string
old guids=true
so example, connection string looks now.
<add name="mydb" connectionstring="server=localhost; database=mydatabase; uid=user; pwd=mypass; old guids=true;" providername="mysql.data.mysqlclient" />
Comments
Post a Comment