gpt4 book ai didi

mysql - Insert语句向数据库添加数据

转载 作者:行者123 更新时间:2023-11-29 23:25:44 24 4
gpt4 key购买 nike

我似乎没有发现我的查询出了什么问题。最后的值是变量的名称

Command.CommandText = (" INSERT INTO [TransfersAndAdditionalCourses]
(TransferCourse1,TransferCourse2, TransferCourse3,
TransferCourse4, TransferCourse5, AdditionalCourse1,
AdditionalCourse2, AdditionalCourse3, AdditionalCourse4, AdditionalCourse5)
VALUES ('" & firstTransferCourse & ",' " & secondTransferCourse
& "," & thirdTransferCourse & " ', '" & fourthTransferCourse & " ','"
& fifthTransferCourse & " ', '" & firstAdditionalCourse & ", "
& secondAdditionalCourse & "',' " & thirdAdditionalCourse & "',' "
& fourthAdditionalCourse & "','" & fifthAdditionalCourse & "' ")

谢谢

最佳答案

在我看来,你缺少一些单引号。

请尝试这个:

Command.CommandText = ("INSERT INTO [TransfersAndAdditionalCourses]
(TransferCourse1,TransferCourse2, TransferCourse3, TransferCourse4,
TransferCourse5, AdditionalCourse1, AdditionalCourse2, AdditionalCourse3,
AdditionalCourse4, AdditionalCourse5)
VALUES ('" & firstTransferCourse & "',' " & secondTransferCourse & "', '"
& thirdTransferCourse & " ', '" & fourthTransferCourse & " ','"
& fifthTransferCourse & " ', '" & firstAdditionalCourse & "', '"
& secondAdditionalCourse & "',' " & thirdAdditionalCourse & "',' "
& fourthAdditionalCourse & "','" & fifthAdditionalCourse & "' ")

关于mysql - Insert语句向数据库添加数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26988099/

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