【问题标题】:Quiz app using titanium and sqlite not giving me the result使用钛和 sqlite 的测验应用程序没有给我结果
【发布时间】:2012-12-18 18:16:50
【问题描述】:

您好,我正在使用钛制作一个测验应用程序。我已使用标签显示答案。我的代码如下

    var options = db.execute('select * from Answers');

var laboption1 = Titanium.UI.createLabel({
text : options.fieldByName('Answer'),
top : '10%',
left : '10%',
color:'black'
 });
 QuizWin.add(laboption1);
 var laboption2 = Titanium.UI.createLabel({
text : options.fieldByName('Answer'),
top : '15%',
left : '10%',
color:'black'
 });
 QuizWin.add(laboption2);
 var laboption3 = Titanium.UI.createLabel({
text : options.fieldByName('Answer'),
top : '20%',
left : '10%',
color:'black'
});
QuizWin.add(laboption3);
var laboption4 = Titanium.UI.createLabel({
text : options.fieldByName('Answer'),
top : '25%',
left : '10%',
color:'black'

});
QuizWin.add(laboption4);

我的sql查询结果如下

   Lahore
   Karachi
    Quetta
   Peshawar

但它在每个条目中只显示拉合尔(第一个条目)。请帮助我

谢谢

【问题讨论】:

    标签: android sqlite mobile titanium


    【解决方案1】:

    在除第一个标签创建之外的所有记录之间添加这些检查以检查有效行并移至下一条记录。

    options.isValidRow() // Check that there is another row in the set
    
    options.next(); // move to the next row in the set of data
    

    【讨论】:

      猜你喜欢
      • 2016-08-10
      • 1970-01-01
      • 1970-01-01
      • 2014-02-02
      • 1970-01-01
      • 2022-12-17
      • 1970-01-01
      • 2021-10-08
      • 1970-01-01
      相关资源
      最近更新 更多