在选择表数据时出现错误“参数类型错误,超出可接受范围或彼此冲突”

时间:2019-04-09 05:37:00

标签: node.js ms-access

执行select * from tablename之类的选择查询时遇到错误

code:-2146825287 message:"Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."

这是我正在使用的代码,

const connection = ADODB.open(
  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
    appRoot.path +
    "\\test.mdb"
);

const query = "SELECT * FROM tablename";

connection
  .query(query)
  .then(data => {
    if (data) {
      console.log(JSON.stringify(data, null, 2));
    }
    callback();
  })
  .catch(error => {
    console.error(error);
    callback(null, error);
  }); 

1 个答案:

答案 0 :(得分:0)

当我检查表中有太多字段时,我找到了解决方案。这样会引发错误。您只需在查询中选择所需的唯一列即可。

例如

select column1, column2,etc. from tablename