我想用MySQL数据库中python脚本创建的一些值更新一个表。问题是这样的:dbCursor.execute("INSERT INTO Solution (ProblemName, TourLength, Date, Author, Algorithm, RunningTime, Tour) VALUES ('%s', '%d', '%s', '%s', '%s', '%d', '%s')" % (sys.argv[1], bestDist, "Foo Bar", "CURDATE()", "Greedy + 2-Opt", timeAllowed, bestRoute))

dbConnection.commit()

它正在生成以下错误:

^{pr2}$

我试着用google搜索这个问题,并在这个网站上寻找解决方案,但我找到的答案都与我的完全匹配。因为这个问题我也没有解决。所以我现在不知道我能做什么。据我所见,我所有的列名都与值和格式化变量匹配。在

是什么导致了这个问题?在CREATE TABLE IF NOT EXISTS Solution (

SolutionID int(11) NOT NULL AUTO_INCREMENT,

ProblemName varchar(32) NOT NULL,

TourLength double NOT NULL,

Date date DEFAULT NULL,

Author varchar(32) DEFAULT NULL,

Algorithm varchar(32) DEFAULT NULL,

RunningTime int(11) DEFAULT NULL,

Tour mediumtext NOT NULL,

CONSTRAINT SPK PRIMARY KEY (SolutionID),

CONSTRAINT SolPName FOREIGN KEY (ProblemName) REFERENCES Problem (Name) ON DELETE CASCADE

);

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐