Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

Como pasar un registro a otra tabla usando getrows usando insert into

Estas en el tema de Como pasar un registro a otra tabla usando getrows usando insert into en el foro de Visual Basic clásico en Foros del Web. SOY PRINCIPIANTE AFICIONADO AL VB Y COMO HE LEIDO QUE ES POSIBLE PASAR UN REGISTRO UTILIZANDO GETROWS LO HICE DEL SIGUIENTE MODO: Dim rstEmployees As ...
  #1 (permalink)  
Antiguo 23/08/2009, 18:26
 
Fecha de Ingreso: agosto-2009
Mensajes: 19
Antigüedad: 14 años, 8 meses
Puntos: 0
Como pasar un registro a otra tabla usando getrows usando insert into

SOY PRINCIPIANTE AFICIONADO AL VB Y COMO HE LEIDO QUE ES POSIBLE PASAR UN REGISTRO UTILIZANDO GETROWS LO HICE DEL SIGUIENTE MODO:

Dim rstEmployees As Recordset
Dim varrecords As Variant
Dim intNumReturned As Integer
Dim intnumcolumns As Integer
Dim intcolumn As Integer, introw As Integer
Set dbs = OpenDatabase("Neptuno.mdb")
Set rstEmployees = dbs.OpenRecordset _
("SELECT Nombre, Apellidos, Cargo " _
& "FROM Empleados", dbOpenSnapshot)
varrecords = rstEmployees.GetRows(1)
HASTA AQUI SE SUPONE QUE varrecords contiene una matriz con una fila y 3 columnas, lo cual comprobado ejecutando con instrucciones y suponiendo valores como xx=varrecords(0,0)
PERO AL TRATAR DE INSERTAR ESTA MATRIZ USANDO LO SIGUIENTE:
dbs.Execute " INSERT INTO CREADACONMATRIX (Nombre, Apellidos, CANTIDAD) VALUES (varrecords(0, 0), varrecords(1, 0), varrecords(2, 0));"

rstEmployees.Close
dbs.Close
NO RECONOCE A varrecords como matriz y me dice que la funcion varrecords no esta definida...........estoy usando VB5 Y TAL PARECE QUE NO ME PERMITE INTRODUCIR VALORES VALUE TIPO MATRIZ O NO SE QUE PASA.. AGRADEZCO SUS RESPUESTAS.
  #2 (permalink)  
Antiguo 28/08/2009, 02:17
 
Fecha de Ingreso: agosto-2009
Mensajes: 19
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: Como pasar un registro a otra tabla usando getrows usando insert into

ENCONTRE EL ERROR EN LA SIGUIENTE DECLARACION:

dbs.Execute " INSERT INTO CREADACONMATRIX (Nombre, Apellidos, CANTIDAD) VALUES (varrecords(0, 0), varrecords(1, 0), varrecords(2, 0));"

DEBE ESCRIBIRSE DEL SIGUIENTE MODO USANDO '"&---&"' PARA QUE SEA ACEPTADO:

dbs.Execute " INSERT INTO CREADACONMATRIX (Nombre, Apellidos, Cargo) VALUES ('" & varrecords(0, 0) & "', '" & varrecords(1, 0) & "', '" & varrecords(2, 0) & "');"

DE ESTA FORMA SI ME RECONOCE LOS VALORES DE VALUE, EN FIN OJALA SIRVA PARA QUIEN TENGA EL MISMO ERROR EN LA SINTAXIS. BY
  #3 (permalink)  
Antiguo 28/08/2009, 07:24
 
Fecha de Ingreso: marzo-2009
Mensajes: 355
Antigüedad: 15 años, 1 mes
Puntos: 4
Respuesta: Como pasar un registro a otra tabla usando getrows usando insert into

Correcto, las comillas simples se utilizan cuando el valor es alfanumerico, pero por seguridad yo lo pongo en todas las variables.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:56.