最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin3浏览0评论

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");`);
})
发布评论

评论列表(0)

  1. 暂无评论