B4J Question MySQL number of records with 3 search parameters[Solved]

Peter Lewis

Active Member
Licensed User
Longtime User
Hi All
I am trying to use 3 search parameters to search a database and give me the quantity of records.

I have tried most options I know and this is the only one that does not say tooo many parameters.

If you have an idea what i should be doing please let me know

Thank you

B4X:
Log(Sql2.ExecQuerySingleResult("SELECT count(*) FROM Questions_db  WHERE `main_cat` LIKE ? and `subCat` LIKE ? and `difficulty` LIKE ? "&Chr(34)&dtaMainCat.Value&Chr(34)&dtaSubCat.Value&Chr(34)&dtaDifficult.SelectedIndex&Chr(34)))

If I use this code below it does bring out all the correct answers but I need to know how many are correct

B4X:
rp = Sql2.ExecQuery2("Select ques_id, main_cat, subCat,question,correct_no,answer1,answer2,answer3,answer4, difficulty FROM Questions_db WHERE `main_cat` LIKE ? and `subCat` LIKE ? and `difficulty` LIKE ? ",Array As String(dtaMainCat.Value, dtaSubCat.Value,dtaDifficult.SelectedIndex ))
 

Peter Lewis

Active Member
Licensed User
Longtime User
I tried the different Statement types and it worked

B4X:
Log(Sql2.ExecQuerySingleResult2("Select count(*) FROM Questions_db WHERE `main_cat` LIKE ? and `subCat` LIKE ? and `difficulty` LIKE ? ",Array As String(dtaMainCat.Value, dtaSubCat.Value,dtaDifficult.SelectedIndex )))
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…