B4J Question SQL check if record exists.

vdudukov

Member
Licensed User
Longtime User
Hi,

I don't know how to check database record in B4J, so if can somebody help please
Thanks!


Here is how I check in B4A



B4X:
txt= "SELECT code FROM contact WHERE name = '" & edit_name.text & "'"
    cursor1 = SQL1.ExecQuery(txt)
    If cursor1.RowCount>0 Then
    Return
    Else
 

vdudukov

Member
Licensed User
Longtime User

Thank you.
This code works for me.


B4X:
 Dim cursor As ResultSet
            cursor = SQL1.ExecQuery("SELECT code FROM contacts WHERE name = '" & edit_name.text & "'")
            If cursor.NextRow Then
            txtLog3.Text = cursor.GetString("code")
            cursor.Close
            Else
            txtLog3.Text = "OK"
            cursor.Close
            End If
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…