如何从承诺中获取信息,而不是返回

时间:2018-03-22 16:04:19

标签: node.js

function getCurrentId ()  {
    var data;
    var query = "INSERT INTO photos (path) VALUES (''); SELECT SCOPE_IDENTITY() AS id ";
    var request = new mssql.Request(connection);
    return new Promise(function(resolve, reject) {
        request.query(query, function(err, data) {
             resolve(data.recordset)
        });
    })
}

var main = async () =>{
    var quote =  await  getCurrentId();
    return quote; enter code here
};

我想要返回值,而不是打印。

0 个答案:

没有答案