Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
View Definition Has Changed !
Message
 
 
À
27/07/1999 10:24:00
Senna Dwipayana
Indo Rebel Apparel Cv
Bandung, Indonésie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00246590
Message ID:
00246623
Vues:
22
>Hi,
>
>I'm using a SQL View that put on a top-level form DataEnvironment with NoDataOnLoad = .T., form.DataSession = 2 ,form.Buffermode = 2, I use this view on a modal form which is launched from top level form,
>until I call = Requery() on an object in modal form, Error message pops up "View Definition Has Changed !" , but if I change NoDataOnLoad Property to .T., it works fine.
>
>Can anyone tell me why ?
>
>
>TIA

This has happened to me before, just last night in fact. What happens when you have NoDataOnLoad = .t. is VFP will create the view structure based on the erroneous field width info. When you do a requery, all the matching records are retrieed as well as the structure needed to hold the data.

How this happened to me was I was retrieving a customer field which was a concatenation of the first and last name fields using the trim() function. The field width created was less than needed by the requery. So I padded the field with the number of spaces needed in my view definition. Example:

Problem Code:

select ... (trim(FirstName) + space(1) + LastName) as Customer ...

Good Code:

select ... (padr(trim(FirstName) + space(1) + LastName, 30, " ") as Customer ...

This forced VFP to define a field width of 30. When I did the NoDataOnLoad, the first matching customer record had no first and last name, only a business name. The width of the Lastname field was 20, so VFP created a Customer field with a width less than 30. When I issued a requery, the first matching record did have a first and last name whose width was more than the initial width.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform