FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Creaci贸n de tablas MYSQL
Posts: 65
Joined: Fri Oct 21, 2005 08:07 PM
Creaci贸n de tablas MYSQL
Posted: Thu Jul 02, 2009 12:55 AM
Hola a todos!!
Estoy tratando de crear una tabla por programa con el siguiente c贸digo

Code (fw): Select all Collapse
oComando:= "DROP TABLE IF EXISTS `mitabla` "

oComando2:= 聽 聽 "CREATE TABLE 聽`pruebas`.`mitabla` ( 聽 聽 聽 "+;
聽 聽 聽 聽 聽 "`EM_CODICIA` float default '0' COMMENT 'CLAVE DE LA EMPRESA',"+;
聽 聽 聽 聽 聽 "`MP_CODPROC` float default '0' COMMENT 'CODIGO DE PROCESO', 聽"+;
聽 聽 聽 聽 聽 "`MT_CODTRAB` float default '0' COMMENT 'CODIGO DE COLABORADOR',"+;
聽 聽 聽 聽 聽 "`CC_CODCONC` float default '0' COMMENT 'CODIGO DE CONCEPTO', "+;
聽 聽 聽 聽 聽 "`CL_PERIODO` float NOT NULL default '0' COMMENT 'PERIODO', 聽 "+;
聽 聽 聽 聽 聽 "`CL_CLAVREG` float default '0' COMMENT 'CLAVE DE REGISTRO', 聽"+;
聽 聽 聽 聽 聽 "`CL_CTACARG` char(6) default '' COMMENT 'CUENTA DE CARGO', 聽 "+;
聽 聽 聽 聽 聽 "`CL_UNIDADE` float(8,2) default '0.00' COMMENT 'UNIDADES DEL CONCEPTO', "+;
聽 聽 聽 聽 聽 "`CL_IMPORTE` float(16,2) default '0.00' COMMENT 'IMPORTE', "+;
聽 聽 聽 聽 聽 "`CL_METCALC` float default '0' COMMENT 'METODO DE CALCULO',"+;
聽 聽 聽 聽 聽 "`CL_TURNOTR` float default '0' COMMENT 'TURNO DEL COLABORADOR', "+;
聽 聽 聽 聽 聽 "`CL_NOM_LGO` char(48) default '' COMMENT 'NOMBRE DEL COLABORADOR', "+;
聽 聽 聽 聽 聽 "`CL_SWPROEX` char(2) default '' COMMENT 'SWITCH DE PROCESO DE EXCEPCION',"+;
聽 聽 聽 聽 聽 "`CL_FORPAGO` char(1) default '' COMMENT 'FORMA DE PAGO',"+;
聽 聽 聽 聽 聽 "`CL_FECHMOV` date default '0000-00-00' COMMENT 'FECHA DE MOVIMIENTO', "+;
聽 聽 聽 聽 聽 "`CL_SECUENC` float default '0' COMMENT 'SECUENCIA', "+;
聽 聽 聽 聽 聽 "`CL_TIPOCON` float default '0' COMMENT 'TIPO DE CONCEPTO', "+;
聽 聽 聽 聽 聽 "`DD_DIVDPTO` float default '0' COMMENT 'CLAVE DEL DEPARTAMENTO', "+;
聽 聽 聽 聽 聽 "`CL_LLAVE` float NOT NULL auto_increment COMMENT 'LLAVE',"+;
聽 聽 聽 聽 聽 "PRIMARY KEY 聽(`CL_LLAVE`),"+;
聽 聽 聽 聽 聽 "UNIQUE KEY `CL_LLAVE` (`CL_LLAVE`)"+;
聽 聽 聽 聽 聽 ") 聽 聽 聽 ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1 COMMENT='AGRUPACION DE CONCEPTOS';"
聽 聽

聽 聽 聽 TRY
聽 聽 聽 聽 oApp := oComando:Execute()
聽 聽 聽 聽 CATCH oErr
聽 聽 聽 聽 MsgInfo("No se puede borrar la tabla", oErr:Description )
聽 聽 聽 END TRY

聽 聽 聽 TRY
聽 聽 聽 聽 oApp := oComando2:Execute()
聽 聽 聽 聽 CATCH oErr
聽 聽 聽 聽 MsgInfo("No se puede crear la tabla", oErr:Description )
聽 聽 聽 END TRY


Y en ambos casos me manda el siguiente error:

Class: 'CHARACTER' has not exported method

驴Alquien puede ayudarme?

Mil gracias de antemano

Laurel.
Code (fw): Select all Collapse
Laurel
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Creaci贸n de tablas MYSQL
Posted: Thu Jul 02, 2009 02:09 AM

Laurel:

D谩le una mirada a mi blog, si es que a煤n no lo haz hecho, ah铆 tienes muchos ejemplos de lo que necesitas.

http://sqlcmd.blogspot.com/

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: Creaci贸n de tablas MYSQL
Posted: Thu Jul 02, 2009 03:00 AM

Laurel,

Homogeniza primero que nada si usas (') apostrofos o los acentos para encerrar cadenas, en mi caso uso los apostrofos.

Despu茅s de eso ejecuta y veras cambios.

Hay servidores que no permiten los acentos y forzosamente deberas usar apostrofos o comillas.

William, Morales

Saludos



m茅xico.sureste
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Creaci贸n de tablas MYSQL
Posted: Thu Jul 02, 2009 05:05 PM

Me parece que tienes errores:
1-tanto oComando y oComando2 son variables que contiene una cadena caracter.
2-por tanto te fallara la expresion siguiente:
TRY
oApp := oComando:Execute()
CATCH oErr
MsgInfo("No se puede borrar la tabla", oErr:Description )
END TRY
por que oComando no es un variable que contenga un objeto ADO y es por ello el error
diferete fuera que hicieras por ejemplo:

cSQL := " DROP TABLE IF EXISTS 'mitabla' "
oADO := CreateObjet("....aca define el objeto ado....") //oAdo contrendra un objeto ado
TRY
oObj := oAdo:Execute( cSQL )
CATCH oErr
MsgInfo("No se puede borrar la tabla", oErr:Description )
END TRY

creo que te puden ayudar las indicaciones en el blog que te indican anteriormente.
tambien hace poco The Full dejo el codigo de una clase que te pude ser util.

salu2

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 65
Joined: Fri Oct 21, 2005 08:07 PM
Re: Creaci贸n de tablas MYSQL
Posted: Thu Jul 02, 2009 07:23 PM

Hola de nuevo!!
Gracias por sus comentarios que me ayudaron a solucionarlo me faltaba indicarle al objeto que le estaba enviando un texto... quedo asi:

oComando:CommandText:= "DROP TABLE IF EXISTS MITABLA "

  TRY
    oApp := oComando:Execute()
    CATCH oErr
    MsgInfo("No se puede borrar",oErr:Description )
  END TRY

Y lo mismo hice para crear la tabla y funcion贸 perfecto!!

Saludos
Laurel :D

Laurel

Continue the discussion