A member function in the
class
function queries the data and returns the result set
in
class DB.
async Query (strSql)
{
await this._conpool.request()
.query(strSql, (err, result) => {
console.dir(result.recordset); //
return result.recordset;
});
}
call
let db = new DB ();
db.Query2 ("select * from sc_Product"). Then (ret = > {
) console.dir(ret);
res.json(ret);
});
has not been able to get the correct data, the previous print shows that the Query function query is correct.
ask for advice!