conn = sqlite3.connect('business_database.db')
c = conn.cursor()
c.execute("INSERT INTO business VALUES(self.nob_text_input.text, self.post_text_input.text, self.descrip_text_input.text )")
conn.commit()
conn.close()
我想使用kivy中的TextInput(即“self.post\u text\u input.text”等)将记录添加到我的数据库中,但出现以下错误:
OperationalError: no such column: self.nob_text_input.text
我尝试在查询中将列放在表名旁边:
c.execute("INSERT INTO business(column1, column2,column3) VALUES(self.nob_text_input.text....)
但我还是犯了同样的错误
将我的评论变成更详细的回答
如果您试图使用字符串中变量(
self.nob_text_input.text
和朋友)的值,则需要将这些值嵌入字符串中一种方法是使用格式字符串:
另一种方法是连接字符串:
相关问题 更多 >
编程相关推荐