问题
I am getting below error when using mssql object in script as:
var mssql =request.services.mssql;
Log entry details
ERROR
Error in script '/api/apitest.js'. TypeError: Cannot read property 'mssql' of undefined at exports.get (D:\home\site\wwwroot\App_Data\config\scripts\api\apitest.js:3:31) [external code]
Please suggest.
Thanks
回答1:
Your problem seems to be a typo: it's request.service.mssql
, not request.services.mssql
as you have in your question (there's no s at the end of service
). Try using the appropriate property name and you should be able to get to the mssql
object.
来源:https://stackoverflow.com/questions/28264430/why-the-mssql-object-can-not-be-identified