Android Question apostrophe in sql

doogal

Member
Licensed User
Longtime User
Hi all,
a user recently encountered an error in one of my apps which involved the use of an apostrophe in a edit text field. I narrowed this down to being a sql error, but unsure how to fix it. This is how my sql statement looks at the moment and I hope someone can help me revise it to accept apostrophes.

B4X:
Main.sql1.ExecNonQuery("UPDATE sideeffect set DrugName ='"& edtBrand.Text & _
                                                              "', SideEffect ='"& edtEffect.Text & _
                                                              "', CurPrev ='"& Main.itemChecked & _
                                                              "', Purpose ='"& edtPurpose.Text & _
                                                            "', GoodBad ='"& Main.goodbadcheck & _
                                                            "', DrugBrand ='"& edtGen.Text & _
                                                              "' WHERE ID = '" & Main.strID & "'")

Thank you
 

doogal

Member
Licensed User
Longtime User
Thanks for the quick reply. This is what I needed. :)

Just tried it and thank you it is working.
 
Last edited:
Upvote 0
Top