tekpub/mvc3 — Issue #4: Registering user : Conversion failed when converting the nvarchar value 'me@email.co.uk' to data type int.
Author: GarethElms
Created: 2011-11-22 21:25:05+00:00
State: open

When I try and register I get this problem. The same issue comes up when I execute the test project.

--------------------------------------

Server Error in '/' Application.

Conversion failed when converting the nvarchar value 'me@email.co.uk' to data type int.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value 'me@email.co.uk' to data type int.

Source Error:

Line 260: cmd.Connection = conn;
Line 261: cmd.Transaction = tx;
Line 262: result += cmd.ExecuteNonQuery();
Line 263: }
Line 264: tx.Commit();

Source File: E:\Users\Gareth\Documents\Code\dotNet\external\tekpub-mvc3-b6feb8e\Source\VidPub.Web\Infrastructure\Massive.cs Line: 262

Stack Trace:

[SqlException (0x80131904): Conversion failed when converting the nvarchar value 'me@email.co.uk' to data type int.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2084770
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5084476
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +215
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
Massive.DynamicModel.Execute(IEnumerable`1 commands) in E:\Users\Gareth\Documents\Code\dotNet\external\tekpub-mvc3-b6feb8e\Source\VidPub.Web\Infrastructure\Massive.cs:262
Massive.DynamicModel.Execute(DbCommand command) in E:\Users\Gareth\Documents\Code\dotNet\external\tekpub-mvc3-b6feb8e\Source\VidPub.Web\Infrastructure\Massive.cs:246
Massive.DynamicModel.Update(Object o, Object key) in E:\Users\Gareth\Documents\Code\dotNet\external\tekpub-mvc3-b6feb8e\Source\VidPub.Web\Infrastructure\Massive.cs:481
CallSite.Target(Closure , CallSite , Users , <>f__AnonymousType6`1 , Object ) +272
VidPub.Web.Model.Users.SetToken(String token, Object id) in E:\Users\Gareth\Documents\Code\dotNet\external\tekpub-mvc3-b6feb8e\Source\VidPub.Web\Model\Users.cs:38
CallSite.Target(Closure , CallSite , Users , String , Object ) +271
VidPub.Web.Controllers.AccountController.SetToken(Object userID) in E:\Users\Gareth\Documents\Code\dotNet\external\tekpub-mvc3-b6feb8e\Source\VidPub.Web\Controllers\AccountController.cs:77
CallSite.Target(Closure , CallSite , AccountController , Object ) +259
VidPub.Web.Controllers.AccountController.Register(String Email, String Password, String Confirm) in E:\Users\Gareth\Documents\Code\dotNet\external\tekpub-mvc3-b6feb8e\Source\VidPub.Web\Controllers\AccountController.cs:67
lambda_method(Closure , ControllerBase , Object[] ) +293
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.b__d() +50
System.Web.Mvc.SecurityUtil.b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8964029
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184