leer datos de una tabla
Saludos.
Este codigo lee de una tabla un registro y actualiza los campor de una pantalla.
Espero que te sirva.
Sub Process_Globals
Dim SQL As SQL
Dim str_sql As String
End Sub
Sub Globals
Dim Edit_Text_Correo As EditText
Dim Edit_Text_sms As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
'define el cursor
Dim c As Cursor
Activity.LoadLayout("ConfigSalida")
Activity.Title = "Configurar Destinos"
If SQL.IsInitialized Then SQL.Close
Try
'inicializa la conexion
SQL.Initialize(main.DBFilePath, DBFileName,False)
'contruye el selec
str_sql = "Select * from ConfigDestino"
c = SQL.ExecQuery(str_sql)
' si no se encontraron registros
If c.RowCount = 0 Then
Edit_Text_Correo.Text = "info@j"
Edit_Text_sms.Text = "+180978787878"
Else
'primera posicion
c.Position = 0
'lee el campo correo y actualiza el label
Edit_Text_Correo.Text = c.GetString("Correo")
'lee el campo sms y actualiza el label
Edit_Text_sms.Text = c.GetString("Sms")
End If
Catch
ToastMessageShow("Error al hacer la consulta " & str_sql, True)
Activity.Finish
End Try
SQL.Close
c.Close
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_KeyPress(KeyCode As Int) As Boolean
Dim Answ As Int
Select KeyCode
Case KeyCodes.KEYCODE_BACK
Answ = Msgbox2("Quiere Salir de Configurar Cuentas ?", "A T E N C I O N", "Si", "", "No", Null)
If Answ = DialogResponse.POSITIVE Then
Return False
Else
Return True
End If
End Select
End Sub
Sub Button_Cancelar_Click
Activity.Finish
End Sub
Sub Button_Aceptar_Click
End Sub