Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何从数据库字段中提取值_Android_Sqlite - Fatal编程技术网

Android 如何从数据库字段中提取值

Android 如何从数据库字段中提取值,android,sqlite,Android,Sqlite,我有一个dd.mm.yyyy格式的字符串日期值。我在数据库中有两列。两者都包含文本值。此值为dd.mm.yyyy格式的日期。我想将我的字符串日期值与这些值进行比较,并想检查它是否位于这些值之间。若我的值大于第一个字段,小于第二个字段,我想获取数据,然后获取一些数据。任何帮助都将不胜感激。您可以查看示例代码,找出解决方案(Sqlite PhoneGAp) 不要将其与用于PhoneGAp的tx.ExecuteSQL()混淆 if(sType=='select' && sMode==

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

您可以查看示例代码,找出解决方案(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);
                     }

如果你的值是日期,为什么要将它们存储为文本?(我知道我以前问过你同样的问题,你也忽略了它…)你今天问了一个类似的问题。请向原始问题添加详细信息,而不是发布新问题。请将日期值转换为毫秒时间,然后比较这两个值。