我使用的是INSERT查询,如果我在值中传递一个字符串,它可以正常工作,如下所示:
oConn.Execute("Insert into Student_Info(Student_Name) values ('Robin')")
但是如果我通过了考试,我就错了QLineEdit.text文件()这样:
oConn.Execute("Insert into Student_Info(Student_Name) values ('"& (self.StudentName.text()) &"')")
错误:
oConn.Execute("Insert into Student_Info(Student_Name) values ('"& (self.StudentName.text()) &"')")
TypeError: unsupported operand type(s) for &: 'str' and 'QString'
请告诉我,我不知道怎么了。你知道吗
你可以用python传递字符串的简单方法,像这样
或者您可以使用字符串concat
相关问题 更多 >
编程相关推荐