SQL and textbox

Status
Not open for further replies.

vdudukov

Member
Licensed User
Longtime User
Hello everybody. I am new on this forum, and I have some questions:)

Simply I dont know how to create activity with 4 textbox (first name, last name, gender, birth date) and with 4 buttons (Add, Edit, Delete and Load). when I save all this data in SQLite database, i want to ,edit these fields, add new, and when I write in first textbox ,First name and press Load, i want to application load all other fields i their textboxes. Is it possible?

I know how to Add, Edit, Delete, but dont know how to Load all this fields back.

Thanks everybody, and sorry for bad English:)
 

Mahares

Expert
Licensed User
Longtime User
To populate the other 3 text boxes, you can do something like this:
B4X:
Dim SQL1 As SQL
Dim Cursor1 As Cursor
Dim Load As Button
Dim txtBox1,txtBox2,txtBox3,txtBox4 As EditText   'initialized in designer
Dim txt As String

Sub Load_Click
   txt= "SELECT first_name, last_name, gender, birth_date FROM MyTable WHERE first_name = '" & txtBox1.Text & "'"
   Cursor1=SQL1.ExecQuery(txt)
   Cursor1.Position=0
   txtBox2.Text=Cursor1.GetString("last_name")
   txtBox3.Text=Cursor1.GetString("gender")
   txtBox4.Text=Cursor1.GetString("birth_date")
End Sub
 
Upvote 0

vdudukov

Member
Licensed User
Longtime User
To populate the other 3 text boxes, you can do something like this:
B4X:
Dim SQL1 As SQL
Dim Cursor1 As Cursor
Dim Load As Button
Dim txtBox1,txtBox2,txtBox3,txtBox4 As EditText   'initialized in designer
Dim txt As String

Sub Load_Click
   txt= "SELECT first_name, last_name, gender, birth_date FROM MyTable WHERE first_name = '" & txtBox1.Text & "'"
   Cursor1=SQL1.ExecQuery(txt)
   Cursor1.Position=0
   txtBox2.Text=Cursor1.GetString("last_name")
   txtBox3.Text=Cursor1.GetString("gender")
   txtBox4.Text=Cursor1.GetString("birth_date")
End Sub

Man You are Genius! Thank you very very very much!:)

If You ever come to Croatia, You have a Big Beer:)

Thanks again:)
 
Upvote 0
Status
Not open for further replies.
Top