Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert in access with vfp6
Message
 
To
19/04/2006 09:38:19
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows XP
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01114563
Message ID:
01114671
Views:
19
Well, we sorted this out over the phone but I'm replying to the thread just for future reference. I see several errors in this code, for example:
carti  = '19999'
cchasi = "HDHDGSS"
ctipo  = "CARRO"
cmarca = "TOYOTA"
cmodelo= "CAMRY"
ccolor = "NEGRO"
nano   = "2005"
cplaca = "ABDG32"
cmotor = '763HSD'

xselect=[insert into vehiculos(articulo,chassis,tipo,marca,modelo,color,ano,placa,motor) values(&carti,&cchasi,&ctipo,&cmarca,&cmodelo,&ccolor,&nano,&cplaca)]
Should be
carti  = '19999'
cchasi = "'HDHDGSS'"
ctipo  = "'CARRO'"
cmarca = "'TOYOTA'"
cmodelo= "'CAMRY'"
ccolor = "'NEGRO'"
nano   = "2005"
cplaca = "'ABDG32'"
cmotor = "'763HSD'"


TEXT TO xSelect 

INSERT INTO vehiculos(articulo,chassis,tipo,marca,modelo,color,ano,placa,motor) VALUES (<<carti>>,<<cchasi>>,<<ctipo>>,<<cmarca>>,<<cmodelo>>,<<ccolor>>,<<nano>>,<<cplaca>>) 

ENDTEXT 

oConn.Execute(xSelect)
The main point here is the command sent to the DB is not returning a recordset because it's not a SQL SELECT statement or a SP, hence having the result into a recordset object triggers an error message.

Enmanuel

>how I can make to insert a registry in a table of Access with vfp 6, I did it with ado object, but insert does not work with more of a field, it gives error me.
>
>pconn=createobject("ADODB.Connection")
>pconn.open(strconn)
>carti = '19999'
>cchasi = "HDHDGSS"
>ctipo = "CARRO"
>cmarca = "TOYOTA"
>cmodelo= "CAMRY"
>ccolor = "NEGRO"
>nano = "2005"
>cplaca = "ABDG32"
>cmotor = '763HSD'
>xselect=[insert into vehiculos(articulo,chassis,tipo,marca,modelo,color,ano,placa,motor) values(&carti,&cchasi,&ctipo,&cmarca,&cmodelo,&ccolor,&nano,&cplaca)]
>rstabla = createobject("ADODB.Recordset")
>oconn =pconn
>rstabla.cursorlocation = 3
>rstabla.cursortype = 2
>rstabla.locktype = 4
>rstabla.open (xselect,oconn)
I'm a mixture of Albert Einstein and Arnold Schwarzenegger. The only trouble is that I got Einstein's body and Schwarzenegger's brain
Previous
Reply
Map
View

Click here to load this message in the networking platform