38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
//---------------------------------------------------------------------------
|
|
|
|
#include <vcl.h>
|
|
#pragma hdrstop
|
|
|
|
#include "capg_tarifas.h"
|
|
//---------------------------------------------------------------------------
|
|
#pragma package(smart_init)
|
|
#pragma resource "*.dfm"
|
|
TfTarifas *fTarifas;
|
|
//---------------------------------------------------------------------------
|
|
__fastcall TfTarifas::TfTarifas(TComponent* Owner)
|
|
: TForm(Owner)
|
|
{
|
|
TbPrecios->Active = true;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TfTarifas::TbPreciosBeforeOpen(TDataSet *DataSet)
|
|
{
|
|
// Si la tabla no existe, la creamos
|
|
if ( !FileExists(TbPrecios -> TableName ) )
|
|
{
|
|
// Usamos la propiedad FielDefs para definir
|
|
// las columnas que contendrá la tabla
|
|
TbPrecios -> FieldDefs -> Clear();
|
|
|
|
TbPrecios -> FieldDefs -> Add("Tiempo", ftInteger, 0, false );
|
|
TbPrecios -> FieldDefs -> Add("Precio", ftCurrency, 0, false );
|
|
|
|
TbPrecios -> IndexDefs -> Clear();
|
|
TbPrecios -> IndexDefs -> Add("Primary", "Tiempo", TIndexOptions() << ixPrimary << ixUnique );
|
|
// Creamos la base...
|
|
TbPrecios -> CreateTable();
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|