Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Refreshing Parameterized View
Message
De
06/09/2000 18:15:53
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australie
 
 
À
06/09/2000 09:08:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00412800
Message ID:
00413226
Vues:
25
Hi Eric & Ko,

Thanks for the suggestions and help. I've managed to get the View to work.

Regards,
Gavin...

>>Hi All,
>>
>> I have a tabbed form with a company page and a contacts page, what I want to be able to do is when I click on the contacts page it shows all the contacts at the company. I can do this easily using a grid with the contacts table as the recordsource which relates to the companyid in the company table. I want to modify the code to use a local parameterized view for the contacts page. I've created the view and added it to the forms dataenvironment, but when I click on the contacts page the contacts grid is empty
>>
>>My view was created using the following code:
>>CREATE SQL VIEW contacts_view AS SELECT * FROM contacts ;
>> WHERE companyid = ?companies.companyid
>>
>>I haven't used Views much and I was kind of hoping that the view would refresh when COMPANIES.COMPANYID changed, is this wishful thinking? Is there a way to do a ReQuery on the grid so that the parameterized view is refreshed with the contacts from the chosen company? Can someone please point me in the right direction?
>>
>
>You need to call the REQUERY function to get the view to run it's SELECT again and refresh itself. After that, you can call the grid's Refresh() method.
>
>As for your view definition, it will work fine, but it's generally a better idea to use a variable name instead of a field name as the parameter, so you aren't tied to that field if you ever want to use the same view in a different place:
>
>CREATE SQL VIEW contacts_view AS SELECT * FROM contacts ;
> WHERE companyid = ?lnCompanyid
>
>Then, when it's time to requery, you'll put:
>
>lnCompanyId = Companies.CompanyId
>=REQUERY("contacts_view")
>THISFORM.grdContacts.Refresh()
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform