Gracias marcelo por tu respuesta. Te adjunto el codigo y puedes mirar que está mal. Yo no he podido hacerlo funcionar.
Function Creatabla()
Local i
Local cCadena
Local oCn :=CreateObject("ADODB.Connection")
Local aNombres := { { "Pedro", "3222551.00", "1998-10-15" }, { "Juan", "2.21", "1998-10-15" }, { "Tadeo", "3.58", "1998-10-15" } }
oCn : Open( "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=alumnos;User=root;Password=root;Option=3;")
oCn : Execute( "drop database if exists alumnos", "DROP" )
oCn : Execute( "create database alumnos", "CREATE" )
oCn : Execute( "create table alumnos( codigo int( 10 ) primary key auto_increment, nombre varchar(30), fecha_nacimiento varchar(15), Importe decimal( 10, 2 ) Default 0.00 ) TYPE=InnoDB ", "CREATE" )
For i := 1 To Len( aNombres )
cCadena := "insert into alumnos(nombre,fecha_nacimiento,importe) values ( '" + aNombres[ i ][ 1 ] + "', '" + aNombres[ i ][ 3 ] + "', " + aNombres[ i ][ 2 ] + " )"
oCn : Execute( cCadena, 'INSERT' ) <- aqui marca error
Next i
oCn : Close()
Return 0
Fichero de error
Path and name: C:\ado\T-REX.EXE (32 bits)
Size: 1,702,400 bytes
Time from start: 0 hours 0 mins 2 secs
Error occurred at: 11/02/07, 17:24:42
Error description: Error ADODB.Connection/16389 E_FAIL: EXECUTE
Args:
[ 1] = C create table alumnos( codigo int( 10 ) primary key auto_increment, nombre varchar(30), fecha_nacimiento varchar(15), Importe decimal( 10, 2 ) Default 0.00 ) TYPE=InnoDB
[ 2] = C CREATE
Stack Calls
===========
Called from: win32ole.prg => TOLEAUTO:EXECUTE(0)
Called from: ado.prg => CREATABLA(213)
Called from: ado.prg => (b)MUESTRASQL(127)
Called from: TOOLBAR.PRG => TTOOLBAR:COMMAND(0)
Called from: window.prg => TMDICHILD:COMMAND(949)
Called from: window.prg => TWINDOW:HANDLEEVENT(0)
Called from: MDICHILD.PRG => TMDICHILD:HANDLEEVENT(0)
Called from: window.prg => _FWH(3159)
Called from: => WINRUN(0)
Called from: window.prg => TMDIFRAME:ACTIVATE(895)
Called from: ado.prg => MAIN(14)