Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Impresión
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 27-09-2005
javicho_villa javicho_villa is offline
Miembro
 
Registrado: feb 2005
Ubicación: Lima - Perú
Posts: 99
Poder: 20
javicho_villa Va por buen camino
Talking Creacion de Indices en ejecucion

Hola a Todos: gracias por la atencion prestada, tengo un problema cuando creo una tabla en tiempo de ejecucion, solo para crear el indice primario, el error que sale o es violacion de llaves o tabla no existe, si alguien me puede ayudar se lo voy a gradecer infinitamente.

Aqui el codigo usado:

//---- Creando una tabla temporal para el detalle de la boleta ----///
Código Delphi [-]
DM.TemporalTable.Close;
 Dm.TemporalTable.TableType := ttParadox;
 Numero := 1;
 MiTabla := '_TEMP_';
 lencontro := false;
 while lencontro=false do begin
 Dm.TemporalTable.TableName := MiTabla+Trim(IntToStr(Numero));
 if Dm.TemporalTable.Exists then Numero := Numero + 1
 else lencontro := true;
 end;
 with Dm.TemporalTable.FieldDefs do
 begin
 Clear;
 Add('Id_Boleta', ftInteger, 0, True);
 Add('Id_Temp', ftInteger, 0, FALSE);
 Add('Uno', ftString, 30, FALSE);
 Add('Dos' , ftFloat, 0, FALSE);
 Add('Tres', ftFloat, 0, FALSE);
 Add('Cuatro', ftString, 30, FALSE);
 Add('Cinco', ftFloat, 0, FALSE);
 Add('Seis', ftFloat, 0, FALSE);
 Add('Siete', ftString, 30, FALSE);
 Add('Ocho', ftFloat, 0, FALSE);
 Add('Nueve', ftFloat, 0, FALSE);
 end;
 Dm.TemporalTable.Exclusive := true;
 Dm.TemporalTable.IndexDefs.Clear;
 with Dm.TemporalTable.IndexDefs.AddIndexDef do begin
 Name := '';
 Fields := 'Id_Boleta';
 Options := [ixPrimary];
 end;
 Dm.TemporalTable.CreateTable;
 Dm.TemporalTable.Active := true;
 Dm.TemporalTable.FieldDefs.Update;
Donde Dm es el Data Module

Última edición por marcoszorrilla fecha: 28-09-2005 a las 07:03:11. Razón: Añadir etiquetas Delphi
Responder Con Cita
  #2  
Antiguo 29-09-2005
javicho_villa javicho_villa is offline
Miembro
 
Registrado: feb 2005
Ubicación: Lima - Perú
Posts: 99
Poder: 20
javicho_villa Va por buen camino
Talking Solucion

Bueno encontre la solucion en el mismo help, ahi explicanm que primero tienes que crear el indice primario para luego crera indices secundarios. el metodo es:

TTable.IndexDef.AddIndexDef.-> ahi le pones el name en una linea, y otros dos poarametros mas,

Gracias por atencion
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 19:57:08.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi