Private Conexion As Connection
Private Tablaaderezos As Result
Public Sub Form_Open()
Me.Center
Conexion = New Connection
Conexion.Type = "sqlite3"
Conexion.Host = "/home/jorge/Escritorio/recetariocompleto/"
Conexion.Name = "simple"
Try Conexion.Open()
If Error Then
Message.Error("Error al conectarse a la base de datos")
Conexion = Null
Else
Tablaaderezos = Conexion.Exec("Select * From aderezos")
If Tablaaderezos.Available Then MostrarCampos
Endif
End
Public Sub MostrarCampos()
TextBox1.Text = Tablaaderezos["id"]
TextBox2.Text = Tablaaderezos["nombre"]
TextBox3.Text = Tablaaderezos["origen"]
TextArea1.Text = Tablaaderezos["ingredi"]
TextArea2.Text = Tablaaderezos["prepara"]
TextArea3.Text = Tablaaderezos["basicos"]
TextArea4.Text = Tablaaderezos["tips"]
TextBox4.Text = Tablaaderezos["tiempop"]
TextBox5.Text = Tablaaderezos["rinde"]
PictureBox1
End
y aqui donde lo añado
Public Sub Button7_Click()
'botton ingresar
Dim VarResult As Result
VarResult = Conexion.Create("aderezos")
VarResult["id"] = TextBox1.Text
VarResult["nombre"] = TextBox2.Text
VarResult["origen"] = TextBox3.Text
VarResult["ingredi"] = TextArea1.Text
VarResult["prepara"] = TextArea2.Text
VarResult["basicos"] = TextArea3.Text
VarResult["tips"] = TextArea4.Text
VarResult["tiempop"] = TextBox4.Text
VarResult["rinde"] = TextBox5.Text
VarResult.Update
Tablaaderezos = Conexion.Exec("Select * from aderezos")
Dialog.Title = ("Añadir imagen a la base de datos")
If Dialog.OpenFile() Then Return
Conexion.Add(Dialog.Path)
Conexion.Select()
y aqui para buscar la foto a poner
Public Sub PictureBox1_MouseDown()
PictureBox1.Stretch = True
Dialog.title = "Seleccione un archivo para abrir"
Dialog.Path = User.Name
Dialog.Filter = ["*.jpg", "JPG", "*.png", "PNG", "*.bmp", "BMP"]
If Not Dialog.OpenFile() Then
PictureBox1.Picture = Picture[Dialog.Path]
Endif
End
' Gambas module file
Public Struct Persona
nombre As String
edad As Integer
direccion As String
telefono As String
End Struct
Public datos As Persona
Public Sub Main()
datos.nombre = "Dario"
datos.edad = 55
datos.direccion = "Valencia 172"
datos.telefono = "479-0804"
Print datos
End
Public Sub Button1_Click()
'Es solo un ejemplo, el comando podía haber sido otro
Shell "ls -l /home/pepe/"
If Error Then
Print "El directorio no existe"
Else
Print "Fin"
Endif
End
Private textoError As String
Public Sub Form_Open()
End
Public Sub Button1_Click()
'Limpiamos siempre el contenido de la variable
textoError = ""
'Es solo un ejemplo, el comando podía haber sido otro
Shell "ls -l /home/pepe/" For Read Write As "Proceso"
End
Public Sub Proceso_Error(sError As String)
textoError &= sError
End
Public Sub Proceso_Read()
Dim sLinea As String
sLinea = Read #Last, Lof(Last)
Print sLinea;
End
Public Sub Proceso_Kill()
If textoError Then Message.Error(textoError)
Print "Proceso Finalizado"
End