简体   繁体   English

任何人都可以帮助我:android.database.sqlite.SQLiteException:靠近“,”:语法错误(代码1):,

[英]May any one please help me: android.database.sqlite.SQLiteException: near ",": syntax error (code 1): ,

Please solve my problem: This is the code line请解决我的问题:这是代码行

Cursor cursor = db.rawQuery("select * from Overhead_Table where IDNO="+incomingrecord[0]+" AND DATE_TIME LIKE "+DTTIME+"%" ,null);

I Also tried:我也试过:

Cursor cursor = db.rawQuery("select * from Overhead_Table where IDNO=? AND DATE_TIME LIKE ?%" ,new String[] {incomingrecord[0],DTTIME});

and

Cursor cursor = db.rawQuery("select * from Overhead_Table where IDNO=? AND DATE_TIME LIKE ?" ,new String[] {incomingrecord[0],DTTIME+"%"});

But it shows error但是显示错误

android.database.sqlite.SQLiteException: near ",": syntax error (code 1): , while compiling: select * from Overhead_Table where IDNO=6765456765 AND DATE_TIME LIKE 14,01,2021 android.database.sqlite.SQLiteException: near ",": syntax error (code 1): , while compiling: select * from Overhead_Table 其中IDNO=6765456765 AND DATE_TIME LIKE 14,01,2021

Always use ?一直用? placeholders:占位符:

String sql = "SELECT * FROM Overhead_Table WHERE IDNO = ? AND DATE_TIME LIKE ? || '%'";
Cursor cursor = db.rawQuery(sql , new String[] {incomingrecord[0], DTTIME});

I assume that both incomingrecord[0] and DTTIME are strings.我假设incomingrecord[0]DTTIME都是字符串。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 android.database.sqlite.SQLiteException:靠近“。”:语法错误(代码1): - android.database.sqlite.SQLiteException: near “.”: syntax error (code 1): , 原因:android.database.sqlite.SQLiteException:附近“”:语法错误(代码1): - Caused by: android.database.sqlite.SQLiteException: near “”: syntax error (code 1): android.database.sqlite.SQLiteException:“;”附近:语法错误(代码1) - android.database.sqlite.SQLiteException: near “;”: syntax error (code 1) android.database.sqlite.SQLiteException:靠近“UNION”:语法错误 - android.database.sqlite.SQLiteException: near "UNION": syntax error Android Studio 创建数据库错误(android.database.sqlite.SQLiteException: near "and": syntax error (code 1): )详解 - Android Studio Create Database error (android.database.sqlite.SQLiteException: near "and": syntax error (code 1): ) Detailed Analysis android.database.sqlite.SQLiteException:“WHERE”附近:语法错误(Sqlite 代码 1) - android.database.sqlite.SQLiteException: near “WHERE”: syntax error (Sqlite code 1) 错误:引起:android.database.sqlite.SQLiteException:near“add”:语法错误(代码1): - Error: Caused by: android.database.sqlite.SQLiteException: near “add”: syntax error (code 1): 引起:android.database.sqlite.SQLiteException:near“”:语法错误(代码1):,同时编译: - Caused by: android.database.sqlite.SQLiteException: near “”: syntax error (code 1): , while compiling: android.database.sqlite.SQLiteException:靠近“ 1”:语法错误(代码1): - android.database.sqlite.SQLiteException: near “1”: syntax error (code 1): , while compiling 造成原因:android.database.sqlite.SQLiteException:“文本”附近:语法错误(代码1): - Caused by: android.database.sqlite.SQLiteException: near “text”: syntax error (code 1):
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM