Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where Clause in a Select
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Where Clause in a Select
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01054926
Message ID:
01054926
Vues:
54
Hi to All,

I need to create in a VFP Form 'one-to-many' this scenario:

1) The Parent Page use a Cursor Adapter of this MS SQL 2000 Table:
CREATE TABLE [SF_Currency] (
  [Currency] varchar(4) COLLATE Latin1_General_CI_AS NOT NULL,
  [Description] varchar(32) COLLATE Latin1_General_CI_AS DEFAULT (''),
  [Symbol] varchar(4) COLLATE Latin1_General_CI_AS DEFAULT (''),
  [InternCode] varchar(4) COLLATE Latin1_General_CI_AS DEFAULT (''),
  [AmountRoundingDigit] smallint DEFAULT (0),
  [AmountRoundingDigit] smallint DEFAULT (0),
  [TaxAmountRoundingType] char(1) COLLATE Latin1_General_CI_AS DEFAULT ('A'),
  [TaxAmountRoundingDigit] smallint DEFAULT (0),
  [NoDecimals] smallint DEFAULT (0),
  [Notes] text COLLATE Latin1_General_CI_AS DEFAULT (''),
  [IsEUCurrency] bit DEFAULT (0),
  [Disabled] bit DEFAULT (0),
  [Ins_Usr] varchar(48) COLLATE Latin1_General_CI_AS DEFAULT (host_name()) NOT NULL,
  [Edt_Usr] varchar(48) COLLATE Latin1_General_CI_AS DEFAULT (host_name()) NOT NULL,
  [Ins_Date] smalldatetime DEFAULT (getdate()) NOT NULL,
  [Edt_Date] smalldatetime DEFAULT (getdate()) NOT NULL,
  CONSTRAINT [PK_Currency] PRIMARY KEY ([Currency])
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
2) The Child Page (Grid) use a Cursor Adapter of this table:
CREATE TABLE [SF_CurrencyFixing] (
  [Currency] varchar(4) COLLATE Latin1_General_CI_AS NOT NULL,
  [ReferredCurrency] varchar(4) COLLATE Latin1_General_CI_AS NOT NULL,
  [FixingDate] datetime NOT NULL,
  [Fixing] float(53) DEFAULT (0),
  [SaleFixing] float(53) DEFAULT (0),
  [PurchaseFixing] float(53) DEFAULT (0),
  [Ins_Usr] varchar(48) COLLATE Latin1_General_CI_AS DEFAULT (host_name()) NOT NULL,
  [Edt_Usr] varchar(48) COLLATE Latin1_General_CI_AS DEFAULT (host_name()) NOT NULL,
  [Ins_Date] smalldatetime DEFAULT (getdate()) NOT NULL,
  [Edt_Date] smalldatetime DEFAULT (getdate()) NOT NULL,
  CONSTRAINT [PK_CurrencyFixing] PRIMARY KEY ([Currency], [ReferredCurrency], [FixingDate]),
  CONSTRAINT [FK_SF_CurrencyFixing] FOREIGN KEY ([Currency]) 
  REFERENCES [dbo].[SF_Currency] ([Currency])
  ON UPDATE NO ACTION
  ON DELETE CASCADE
)
ON [PRIMARY]
GO
3) Each Record of SF_CurrencyFixing Table is a row in the Child Grid

4) The Field Currency in SF_CurrencyFixing must be the same as in SF_Currency; for this I have entered in SelectCmd Property of SF_CurrencyFixing Cursor Adpter this Select:
Select SF_CurrencyFixing.Currency, SF_CurrencyFixing.REFERREDCurrency, SF_CurrencyFixing.FIXINGDATE, SF_CurrencyFixing.FIXING, SF_CurrencyFixing.SALEFIXING, SF_CurrencyFixing.PURCHASEFIXING, SF_CurrencyFixing.INS_USR, SF_CurrencyFixing.EDT_USR, SF_CurrencyFixing.INS_DATE, SF_CurrencyFixing.EDT_DATE From SF_CurrencyFixing WHERE Currency=?CASF_Currency.Currency
And with this Select The form work fine.

5) The Field ReferredCurrency in SF_CurrencyFixing is a pickfield and must be different from the field Currency used in the SF_Currency Table.
For this, I have thought to create a new Cursor Adapter for SF_Currency with this Select in the SelectCmd:
Select SF_CurrencyFixing.Currency, SF_CurrencyFixing.REFERREDCurrency, SF_CurrencyFixing.FIXINGDATE, SF_CurrencyFixing.FIXING, SF_CurrencyFixing.SALEFIXING, SF_CurrencyFixing.PURCHASEFIXING, SF_CurrencyFixing.INS_USR, SF_CurrencyFixing.EDT_USR, SF_CurrencyFixing.INS_DATE, SF_CurrencyFixing.EDT_DATE From SF_CurrencyFixing WHERE Currency<>CASF_Currency.Currency
But, I am not sure that it is the better method and I am not sure that the syntax of Select is right.

Please, Someone can help me?
Thank You and best Regards
Nino
Répondre
Fil
Voir

Click here to load this message in the networking platform