javascript - Error: SQLITE_ERROR: no such column: undefined - Stack Overflow

I'm using SQLite3I have a columns but the error says that column "undefined" is not cre

I'm using SQLite3 I have a columns but the error says that column "undefined" is not created.

const SQLite = require('sqlite3').verbose();
const db = new SQLite.Database('./database.sqlite');
db.serialize(function() {
db.run(`INSERT INTO users (id, name, soul, money, level, exp, items, weapon, 
armor, inbattle) VALUES(${message.author.id}, ${message.author.name}, 
"determination", 0, 1, 0, "DogFood", "Stick", "Bandage", "False");`);
})

events.js:183 throw er; // Unhandled 'error' event

Error: SQLITE_ERROR: no such column: undefined

I'm using SQLite3 I have a columns but the error says that column "undefined" is not created.

const SQLite = require('sqlite3').verbose();
const db = new SQLite.Database('./database.sqlite');
db.serialize(function() {
db.run(`INSERT INTO users (id, name, soul, money, level, exp, items, weapon, 
armor, inbattle) VALUES(${message.author.id}, ${message.author.name}, 
"determination", 0, 1, 0, "DogFood", "Stick", "Bandage", "False");`);
})

events.js:183 throw er; // Unhandled 'error' event

Error: SQLITE_ERROR: no such column: undefined

Share Improve this question edited Oct 5, 2018 at 22:01 ifbamoq asked Oct 5, 2018 at 21:52 ifbamoqifbamoq 4471 gold badge5 silver badges17 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

The fix of another error was adding the "" to ${message.author.username}. Final code:

const SQLite = require('sqlite3').verbose();
const db = new SQLite.Database('./database.sqlite');
db.serialize(function() {
db.run(`INSERT INTO users (id, name, soul, money, level, exp, items, weapon, 
armor, inbattle) VALUES("${message.author.id}", "${message.author.username}", 
"determination", 0, 1, 0, "DogFood", "Stick", "Bandage", "False");`);
})

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745355896a4624115.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信