añadir campo a una base de datos

añadir campo a una base de datos

Postby MOISES » Thu Jul 31, 2008 9:18 pm

Hola:

Tengo una dbf con datos y me gustaría añadir nuevos campos, pero no he encontrado la función.

Muchas gracias.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Postby MauroArevalo » Thu Jul 31, 2008 9:25 pm

Moises:

Espero te sirva.


Code: Select all  Expand view  RUN
USE(HTER) EXCLUSIVE NEW ALIA HTER  //Para cambiar la estructura en tiempo de ejecución.
IF !NETERR()
  StruVieja:=DBSTRUCT()
  StruNueva:={{"HTCODIGO","C",10,0},{"HTNOMBRE","C",35,0},{"HTARREND","C",35,0},{"HTIDENTI","C",10,0},;
              {"HTDIRECC","C",40,0},{"HTCORREO","C",40,0},{"HTSDOINT","N",12,2},{"HTINTANO","N",12,2},;
              {"HTINTPAG","N",12,2},{"HTCUOTAS","N",12,2},{"HTPARQUE","N",12,2},{"HTARRIEN","N",02,0},;
         {"HTCTAANT","N",12,2},{"HTADMSDO","N",12,2},{"HTADMDEB","N",12,2},{"HTADMCRE","N",12,2},;
         {"HTAGUSDO","N",12,2},{"HTAGUDEB","N",12,2},{"HTAGUCRE","N",12,2},{"HTLUZSDO","N",12,2},;
         {"HTLUZCRE","N",12,2},{"HTLUZDEB","N",12,2},{"HTEXTSDO","N",12,2},{"HTEXTDEB","N",12,2},;
         {"HTEXTCRE","N",12,2},{"HTOTRSDO","N",12,2},{"HTOTRDEB","N",12,2},{"HTOTRCRE","N",12,2},;
         {"HTMULSDO","N",12,2},{"HTMULDEB","N",12,2},{"HTMULCRE","N",12,2},{"HTPARSDO","N",12,2},;
         {"HTPARDEB","N",12,2},{"HTPARCRE","N",12,2},{"HTREGIST","N", 5,0},{"HTCOPRO1","N", 7,5},;
         {"HTCOPRO2","N", 6,2},{"HTLOCOFI","N", 3,0},{"HUCOD   ","C", 2,0},{"HUFEC   ","D", 8,0},;
         {"HTUNIDAD","C", 5,0},{"HTESCRIT","C", 5,0},{"HTNOTARI","N", 3,0},{"HTFECESC","D", 8,0},;
         {"HTREGAPT","N",10,0},{"HTTELAPT","C",10,0},{"HTTELOFI","C",10,0}}
   StrVieja:=LEN(StruVieja)
   StrNueva:=LEN(StruNueva)
   IF StrVieja#StrNueva   //Verifica si hay diferencia crea una nueva temporal y la cambia..
     COPY TO COPIATER
     DBCREATE("TEMPOT",StruNueva)
     USE TEMPOT
     CMS=DIRARCEMP+"HT"+CODEMP+ANO
     APPE FROM &CMS
     COPY TO (HTER)
    ELSE
     IF StrVieja==StrNueva   //Verifica si hay diferencia crea una nueva temporal y la cambia..
       COPY TO COPIATER
       DBCREATE("TEMPOT",StruNueva)
       USE TEMPOT
       CMS=DIRARCEMP+"HT"+CODEMP+ANO
       APPE FROM &CMS
       COPY TO (HTER)
     ENDIF
   ENDIF
ELSE
  BLOQUEO()
  CLOS DATA
  RETU
ENDIF



Saludos
Edgar Mauricio Arévalo Mogollón.
Bogotá DC. Colombia
FWH FTDN, xHarbour 1.2.1, Pelles C, Fivedit, Visual Studio Code, Borland 7.30, Mysql, Dbfs
http://www.hymplus.com http://www.hymlyma.com
Tratando de retomar la programación....
User avatar
MauroArevalo
 
Posts: 107
Joined: Thu Jan 19, 2006 11:47 pm
Location: Bogota DC. Colombia

Postby MOISES » Fri Aug 01, 2008 8:58 am

Hola:

Sí, así lo hago yo, pero buscaba una metafunción, del tipo addfield, y listo.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 38 guests