Sub Class_Globals
Type UpdateType( CustomerCode As String, EditText As String)
End Sub
Private Sub YourSub
Dim rs As ResultSet = Database.SQL.ExecQuery("SELECT dbo.FCustomer.customerCode,dbo.FCustomer.customerName,dbo.FCustomer.etebar,dbo.Person.phoneNo1,dbo.Person.address FROM dbo.FCustomer INNER JOIN dbo.Person ON dbo.FCustomer.person_ID = dbo.Person.id; ")
Do While rs.NextRow
'...
Button1.Tag = CreateUpdateType( rs.GetString("customerCode"), EditText1.Text)
'...
Loop
End Sub
Private Sub Button1_Click
Dim btn As B4XView = Sender
Dim Update As UpdateType = btn.Tag
Dim cmd As String = " UPDATE dbo.FCustomer SET etebar = ? WHERE customerCode = ?"
Database.SQL.ExecNonQuery2( cmd, Array As String( Update.EditText, Update.CustomerCode)) 'parameterized query
End Sub
Public Sub CreateUpdateType (CustomerCode As String, EditText As String) As UpdateType
Dim t1 As UpdateType
t1.Initialize
t1.CustomerCode = CustomerCode
t1.EditText = EditText
Return t1
End Sub