检查 Android 中 Sqlite 中的现有记录?
大家好,
我正在尝试在插入记录之前检查 Android 中是否存在现有记录。我收到一个异常,当我检查 logcat 时,它说它是一个语法错误。需要一些紧急帮助,
谢谢
DbConnection dbConnection = new DbConnection(EnterDetails.this);
db = dbConnection.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT 1 FROM" + DbConnection.TABLE + " WHERE "+ DbConnection.C_MNUMBER + " = " +EditTextMobileNumber.getText().toString().trim(),null);
boolean flag = (cursor.getCount() > 0);
Toast.makeText(EnterDetails.this,"Record Found",Toast.LENGTH_LONG).show();
return false;
Hii guys
Im trying to check for an existing record in android before inserting a record. i get an exception and when i check the logcat it says its a syntax error. need some Urget help with this guys
thanks
DbConnection dbConnection = new DbConnection(EnterDetails.this);
db = dbConnection.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT 1 FROM" + DbConnection.TABLE + " WHERE "+ DbConnection.C_MNUMBER + " = " +EditTextMobileNumber.getText().toString().trim(),null);
boolean flag = (cursor.getCount() > 0);
Toast.makeText(EnterDetails.this,"Record Found",Toast.LENGTH_LONG).show();
return false;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改:
至
Change:
to