Issue
I am trying to make a function that when you open the app the first thing it does it checks with a query if there are any null values in sql the code is this:
public static String checkParameters(Context ctx){
Parameters prm = new Parameters(ctx);
SQLiteDatabase db = prm.getWritableDatabase();
String count = "select * from table paramname where paramvalue=''";
Cursor c = db.rawQuery(count, null);
c.moveToFirst();
int icount = c.getInt(0);
if(icount > 0){
"Success";
}else{
"Error";
}
return null;
}
But this isnt working i need to make the function check which paramname has paramvalue empty and print that paramname.
Solution
Do this
public static String checkParameters(Context ctx){
Parameters prm = new Parameters(ctx);
SQLiteDatabase db = prm.getWritableDatabase();
String count = "select * from table paramname where paramvalue=''";
Cursor c = db.rawQuery(count, null);
c.moveToFirst();
if(c.getCount()>0){
if(c.moveToFirst()){
string values = "";
do{
values = c.getString(0);
values += "\n";
}while(c.moveToNext());
}
return null;
Answered By - Kostandin Vllahu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.