gpt4 book ai didi

c# - 在 SET 子句中多次指定列名 'phoneNumber'

转载 作者:行者123 更新时间:2023-12-01 22:08:52 26 4
gpt4 key购买 nike

我正在为我的学生项目创建一个在线咖啡店。

因为它是一个大文件,而且我不确定有人需要哪一部分,这里是 github link

我已经创建了注册表单和订单表。

当我尝试注册时,在第二页出现此错误

完整的消息错误是:说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。

异常详细信息:System.Data.SqlClient.SqlException:在 INSERT 的 SET 子句或列列表中多次指定了列名称“phoneNumber”。在同一子句中不能为一列分配多个值。修改子句以确保列只更新一次。如果此语句更新列或将列插入 View ,列别名可以隐藏代码中的重复项。

来源错误:

第 164 行:
第 165 行:};第 166 行:var result = await UserManager.CreateAsync(user, model.Password);第 167 行:if (result.Succeeded)第 168 行:{

完整日志如下:

[SqlException (0x80131904): The column name 'phoneNumber' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +212<br/>
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection, Action
1 wrapCloseInAction) +81
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +630
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4222
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) +261
System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader(Boolean isInternal, Boolean forDescribeParameterEncryption) +254
System.Data.SqlClient.SqlCommand.InternalEndExecuteNonQuery(IAsyncResult asyncResult, String endMethod, Boolean isInternal) +651
System.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult) +245
System.Data.SqlClient.SqlCommand.EndExecuteNonQueryAsync(IAsyncResult asyncResult) +151
System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult
iar, Func
2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) +86
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 System.Data.Entity.Utilities.CultureAwaiter`1.GetResult() +38 System.Data.Entity.Core.Mapping.Update.Internal.d__0.MoveNext() +2736 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
System.Data.Entity.Core.Mapping.Update.Internal.d__0.MoveNext() +398

[UpdateException: An error occurred while updating the entries. See the inner exception for details.]
System.Data.Entity.Core.Mapping.Update.Internal.d__0.MoveNext() +631 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
System.Data.Entity.Core.Objects.d__3d1.MoveNext()
+743 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +99<br/>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +61<br/>
System.Data.Entity.Core.Objects.<SaveChangesToStoreAsync>d__39.MoveNext()
+386 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +99<br/>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +61<br/>
System.Data.Entity.SqlServer.<ExecuteAsyncImplementation>d__9
1.MoveNext() +348 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
System.Data.Entity.Core.Objects.d__31.MoveNext() +802

[DbUpdateException: An error occurred while updating the entries. See the inner exception for details.]
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
Microsoft.AspNet.Identity.EntityFramework.d__5a.MoveNext() +217 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
Microsoft.AspNet.Identity.EntityFramework.d__16.MoveNext() +250 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 Microsoft.AspNet.Identity.CultureAwaiter.GetResult() +35 Microsoft.AspNet.Identity.d__0.MoveNext() +1126
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 Microsoft.AspNet.Identity.d__d.MoveNext() +550 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
+28 registrationLogin.Controllers.<Register>d__15.MoveNext() in C:\Users\Itzik
Private\Documents\GitHub\DatabaseMVC\registrationLogin\registrationLogin\Controllers\AccountController.cs:166
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +99<br/>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +61<br/>
System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult
asyncResult) +97<br/>
System.Web.Mvc.Async.<>c__DisplayClass8_0.<BeginInvokeAsynchronousActionMethod>b__1(IAsyncResult
asyncResult) +17<br/>
System.Web.Mvc.Async.WrappedAsyncResult
1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49<br/>
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult
asyncResult) +32<br/>
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0()
+50 System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2()
+228 System.Web.Mvc.Async.<>c__DisplayClass7_0.<BeginInvokeActionMethodWithFilters>b__1(IAsyncResult asyncResult) +10<br/>
System.Web.Mvc.Async.WrappedAsyncResult
1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49<br/>
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult
asyncResult) +34<br/>
System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__3()
+35 System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult
asyncResult) +100<br/>
System.Web.Mvc.Async.WrappedAsyncResult
1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49<br/>
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult
asyncResult) +27<br/>
System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult
asyncResult, ExecuteCoreState innerState) +11<br/>
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49<br/>
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +45
System.Web.Mvc.<>c.<BeginExecute>b__151_2(IAsyncResult asyncResult,
Controller controller) +13<br/>
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) +22
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49<br/>
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26<br/>
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult
asyncResult) +10<br/>
System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult
asyncResult, ProcessRequestState innerState) +28<br/>
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.InvokeEndHandler(IAsyncResult ar) +152 System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +126

最佳答案

错误很明显,您尝试使用插入查询,但在命令中指定了两次 phone number 列:

在 SET 子句或 INSERT 的列列表中多次指定了列名称“phoneNumber”。

再次检查您的查询并消除双重冲突,它将解决您的问题。

关于c# - 在 SET 子句中多次指定列名 'phoneNumber',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49773359/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com