颤振中不存在获取SQL语法错误列

时间:2019-11-04 09:35:54

标签: sqlite flutter

sql语法如何在Flutter中工作?我收到一个错误消息,说一列不存在。

Exception has occurred.
SqfliteDatabaseException (DatabaseException(Error Domain=FMDatabase Code=1 "table addCashTable has no column named frequency" UserInfo={NSLocalizedDescription=table addCashTable has no column named frequency}) sql ' INSERT INTO addCashTable

这是我的SQL

  static Future<void> addAddCash(AddCash addCash) async {
    final sql = ''' INSERT INTO ${DatabaseCreator.addCashTable}
    (
      ${DatabaseCreator.id},
      ${DatabaseCreator.name},
      ${DatabaseCreator.amount},
      ${DatabaseCreator.date},
      ${DatabaseCreator.frequency},
      ${DatabaseCreator.isDeleted}
    )
VALUES
    (
      \'${addCash.id}\',
      \'${addCash.name}\',
      \'${addCash.amount}\',
      \'${addCash.date}\',
      \'${addCash.frequency}\',
      \'${addCash.isDeleted ? 1 : 0}\'
    )''';
    final result = await db.rawInsert(sql);
    DatabaseCreator.databaseLog('Add Cash', sql, null, result);
  }

0 个答案:

没有答案