Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 无法从ms access数据库获取日期列。使用的节点adodb节点模块_Node.js_Ms Access_Adodb - Fatal编程技术网

Node.js 无法从ms access数据库获取日期列。使用的节点adodb节点模块

Node.js 无法从ms access数据库获取日期列。使用的节点adodb节点模块,node.js,ms-access,adodb,Node.js,Ms Access,Adodb,我注意到查询结果中没有返回日期字段的问题 我正在使用版本:2.0.2 “我的日期”列名称-帐户日期和表名称-帐户日志日期格式为-*1/2/1970 3:46:25 PM* 我的问题是: SELECT MAX(AccountingLog.AcctDate) FROM AccountingLog WHERE AccountingLog.UserId = "'+userID+'"' 我还尝试了这个查询:从AccountingLog中选择* 使用上述查询无法捕获日期列 提前谢谢。我遇到了同样的问题。谷

我注意到查询结果中没有返回日期字段的问题

我正在使用版本:2.0.2

“我的日期”列名称-帐户日期和表名称-帐户日志日期格式为-*1/2/1970 3:46:25 PM* 我的问题是:

SELECT MAX(AccountingLog.AcctDate) FROM AccountingLog WHERE AccountingLog.UserId = "'+userID+'"'
我还尝试了这个查询:从AccountingLog中选择*

使用上述查询无法捕获日期列


提前谢谢。

我遇到了同样的问题。谷歌没有给我提供关于这个问题的好结果。 我在adodb.js文件中发现了这个问题。 Ms access为日期字段返回varDate类型,varDate类型不允许字符串,因此无法转换日期字段

/**
* Fill records array
* @param recordset
* @returns {Array}
*/
function fillRecords(recordset){
  var item, records = [],
  count = recordset.Fields.Count;
  // Not empty
  if (!recordset.BOF || !recordset.EOF) {
    recordset.MoveFirst();

    while (!recordset.EOF) {
      item = {};
      for (var i = 0; i < count; i++) {
        var field = recordset.Fields.Item(i);
          item[field.name] = field.toString(); // CODE FAILS HERE FOR 'varDate'
        }
      records.push(item);
      recordset.MoveNext();
    }
  }
  return records;
}
我在上述函数中添加了检查日期列名称ms access db字段。因此,当recordset.Field为varDate时,第一个varDate将转换为新日期,然后应用字符串转换。请在下面找到代码片段

function fillRecords(recordset){
  var item, records = [],
  count = recordset.Fields.Count;
  // Not empty
  if (!recordset.BOF || !recordset.EOF) {
    recordset.MoveFirst();

    while (!recordset.EOF) {
      item = {};
      for (var i = 0; i < count; i++) {
        var field = recordset.Fields.Item(i);
        // ADDED below condition.
        if(field.name === "ActivationTime" || field.name === "CreateDate")
        {
          var dateYear = new Date(field.value);
          item[field.name] = dateYear.toString();
        }else{
          item[field.name] = field.value;
        }

      }
      records.push(item);
      recordset.MoveNext();
    }
  }
  return records;
}