IBM Worklight Mobile调用SQL适配器不显示记录
在ibm文档和其他博客之后,我尝试调用SQL适配器在移动模拟器中显示结果 遵循文档“Module_06_u-u调用_Adapter_Procedures_u从_Client_Applications.pdf下载” 以下是我的代码:- 第一步 MOBISQLAdap1 impl.jsIBM Worklight Mobile调用SQL适配器不显示记录,mobile,ibm-mobilefirst,adapter,procedure,Mobile,Ibm Mobilefirst,Adapter,Procedure,在ibm文档和其他博客之后,我尝试调用SQL适配器在移动模拟器中显示结果 遵循文档“Module_06_u-u调用_Adapter_Procedures_u从_Client_Applications.pdf下载” 以下是我的代码:- 第一步 MOBISQLAdap1 impl.js var procedure1Statement = WL.Server.createSQLStatement("select * from sqldb.dbo.table1"); function procedure
var procedure1Statement = WL.Server.createSQLStatement("select * from sqldb.dbo.table1");
function procedure1(param) {
return WL.Server.invokeSQLStatement({
preparedStatement : procedure1Statement,
parameters : [param]
});
}
调用SQL适配器时,它会显示结果。这里一切都好
步骤2:-创建名为Mobi的应用程序
步骤3:-common/js/initOptions.js
在common/js/initOptions.js文件中;未注释该行,且该值为true
var wlInitOptions = {
// # Should application automatically attempt to connect to Worklight Server on application start up
// # The default value is true, we are overriding it to false here.
connectOnStartup : true,
步骤4:common/js/main.js文件
function loadSQLRecords(){
var invocationData = {
adapter : 'MOBISQLAdap1',
procedure : 'procedure1',
parameters : []
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : loadSQLQuerySuccess,
onFailure : loadSQLQueryFailure
});
}
function loadSQLQuerySuccess(result){
WL.Logger.debug("Retrieve success" + JSON.stringify(result));
displayFeeds(result.invocationResult.resultSet);
}
function loadSQLQueryFailure(result){
WL.Logger.error("Retrieve failure");
}
第五步:common/js/index.html文件;在正文部分
<body id="content" style="display: none;">
<div id="itemsList"></div>
<!--application UI goes here-->
Display of data
<script src="js/initOptions.js"></script>
<script src="js/main.js"></script>
<script src="js/messages.js"></script>
</body>
数据显示
预览时,SQL适配器值不会显示在应用程序中。在预览之前进行了构建和部署
谢谢你的帮助。感谢rb您从问题中省略了最重要的代码片段-
displayFeeds()
,这使得无法调试
此外,您不必提及是否存在任何错误-打开Chrome dev tools>console,在预览应用程序时查看是否存在任何错误
最后,这个问题已经被问了很多次。请搜索。下面是几个关于同一个问题的问题