-4

我有一个 dd.mm.yyyy 格式的字符串日期值。我在数据库中有两列。两者都包含文本值。该值是 dd.mm.yyyy 格式的日期。我想将我的字符串日期值与这些进行比较。并想检查它是否位于这些之间。如果我的值大于第一个字段并且小于第二个字段,我想获取数据然后获取一些数据。任何帮助将不胜感激。

4

1 回答 1

0

您可以查看示例代码以找出解决方案(Sqlite-PhoneGAp)

不要与用于 PhoneGAp 的 tx.ExecuteSQL() 混淆

 if(sType=='select' && sMode=='select'){

                     //SELECT * from Em_Expense where strftime('%m', expdate)='06' and strftime('%Y', expdate)='2011'

                     tx.executeSql('SELECT expenseType,expdate,description,price,mode from Em_Expense where strftime(\'%m\', expdate)="'+sMonth+'" and strftime(\'%Y\', expdate)="'+sYear+'"', [],queryCustomSearchSuccess, errorCB);
                 }
                 else if(sMode=='select' && sType!='select')
                     {

                     tx.executeSql('SELECT expenseType,expdate,description,price,mode from Em_Expense where strftime(\'%m\', expdate)="'+sMonth+'" and strftime(\'%Y\', expdate)="'+sYear+'" and expenseType="'+ sType +'"', [],queryCustomSearchSuccess, errorCB);
                     }
                 else if(sType=='select' && sMode !='select')
                     {

                     tx.executeSql('SELECT expenseType,expdate,description,price,mode from Em_Expense where strftime(\'%m\', expdate)="'+sMonth+'" and strftime(\'%Y\', expdate)="'+sYear+'" and mode="'+ sMode +'"', [],queryCustomSearchSuccess, errorCB);
                     }
                 else
                     {
                     tx.executeSql('SELECT expenseType,expdate,description,price,mode from Em_Expense where strftime(\'%m\', expdate)="'+sMonth+'" and strftime(\'%Y\', expdate)="'+sYear+'" and mode="'+ sMode +'" and expenseType="'+sType+'"', [],queryCustomSearchSuccess, errorCB);
                     }
于 2013-03-11T10:56:16.140 回答