insert into...
Publicado por jesusjaime (48 intervenciones) el 05/08/2005 11:03:37
hola
tengo este codigo:
Set base = New ADODB.Connection
Set Personas = New ADODB.Recordset
base.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\isce.mdb" & ";Persist Security Info=False"
Set Inserta = New ADODB.Command
Inserta.ActiveConnection = base
Personas.Open "SELECT * FROM clientes", base, adOpenDynamic
Inserta.CommandText = "insert into clientes (IDcliente,Nombre,Dirección,Ciudad,RFC,[Telefono_Particular],[Telefono_oficina],[E-mail],Celular) values ('" & Text1(0).Text & "','" & Text1(1).Text & "','" & Text1(2).Text & "','" & Text1(3).Text & "','" & Text1(4).Text & "','" & Text1(5).Text & "','" & Text1(6).Text & "','" & Text1(7).Text & "','" & Text1(8).Text & "')"
Inserta.Execute
Personas.Close
MsgBox "Registro Agregado", vbInformation + vbOKOnly, "Cliente"
Dim i As Integer
For i = 0 To 8
Text1(i) = ""
Next
Text1(0).SetFocus
el codigo esta bien cuando se teclean todos los registros en cada text1(i) pero si hace falta uno no lo agrega y me marca error, lo que quiero es que permita que pueda contener valores nulos, espero haberme explicado... de antemano muchas gracias!!!
tengo este codigo:
Set base = New ADODB.Connection
Set Personas = New ADODB.Recordset
base.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\isce.mdb" & ";Persist Security Info=False"
Set Inserta = New ADODB.Command
Inserta.ActiveConnection = base
Personas.Open "SELECT * FROM clientes", base, adOpenDynamic
Inserta.CommandText = "insert into clientes (IDcliente,Nombre,Dirección,Ciudad,RFC,[Telefono_Particular],[Telefono_oficina],[E-mail],Celular) values ('" & Text1(0).Text & "','" & Text1(1).Text & "','" & Text1(2).Text & "','" & Text1(3).Text & "','" & Text1(4).Text & "','" & Text1(5).Text & "','" & Text1(6).Text & "','" & Text1(7).Text & "','" & Text1(8).Text & "')"
Inserta.Execute
Personas.Close
MsgBox "Registro Agregado", vbInformation + vbOKOnly, "Cliente"
Dim i As Integer
For i = 0 To 8
Text1(i) = ""
Next
Text1(0).SetFocus
el codigo esta bien cuando se teclean todos los registros en cada text1(i) pero si hace falta uno no lo agrega y me marca error, lo que quiero es que permita que pueda contener valores nulos, espero haberme explicado... de antemano muchas gracias!!!
Valora esta pregunta


0