Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/11/2008, 21:41
vdiaz18
 
Fecha de Ingreso: octubre-2008
Mensajes: 24
Antigüedad: 15 años, 7 meses
Puntos: 0
Respuesta: guardar datos de un textbox a una base de datos

SALUDOS POR EJEMPLO PUEDES HACER DE LA SIGUIENTE MANERA:

SUPONIENDO Q EN LA TABLA FACTURA TIENES LOS SIGUIENTES CAMPOS CON SU TIPO DE DATO CORRESPONDIENTE PUEDES HACER LO SIGUIENTE: Camp1 numerico, Camp2 caracter, Camp3 fecha

utilizando ADO genera una cadena de conexion a la base de datos...

luego prueba este codigo

Private Sub Command1_Click()
Dim Cnn As ADODB.Connection
Dim Rst As ADODB.Recordset
Dim CadenaSQL As String
Set Cnn = New ADODB.Connection
Set Rst = New ADODB.Recordset
CadenaSQL = "INSERT INTO Tabla_Factura VALUES(" & Me.Text1 & ",'" & Me.Text2 & "','" & Me.Text3 & "')"
Cnn.Execute (CadenaSQL)
'nota
'si trabajas con base de datos SQl Server la fecha tiene este formato '2008/11/19'
'pero si trabajas con Access (no recomendable) la fecha tiene este formato #2008/11/19#
End Sub

suerte y comunica novedades