>>Hi everyone,
>>
>>One of my application currently uses predefined hidden filter technique. I think, that it would be better to use view instead. Threfore my question is: how can I create view on the fly? I pass TableName as a parameter, then I have to find owning database, open it, set it to be current and then create a view, right? I also have to delete this view programmatically in Form.Destroy method. Could you please give me a little help here? Also am I right in my assumption, that view should be faster, than filtered tables (I want to create a view based on one table with where equals filter condition)?
>>
>> Thanks in advance.
>Yes Creating the view on the fly should be faster
>
>The syntax is simple --
>
>
>OPEN DATABASE WarrenGroupDataBase
>SET DATABASE TO WarrenGroupDataBase
>CREATE VIEW Nadya AS SELECT Nosonovsky.* FROM WarrenGroupDataBase!Nosonovsky ;
> WHERE LastName="SMITH"
>USE Nadya
>
>
>Then, when you want to delete the view:
>
>USE IN Nadya
>DROP VIEW Nadya
>
>Note -- if the view is to be updatable then you will have to issue a whole bunch of Dbsetprops. I'm going to assume for moment that for a given form you will have a series of views with the same name and structure with only the where clause changing.
>
>If this assumption is the case then you can use eview to create an updatable example of the view with a hard coded where clause (filter). Use the export function of eview to export the view to a prg file. Now go back to creating your view on the fly, but cut and pase all the dbsetprops from the generated program into your code.
Thanks a lot, Gar. This is exactly what I'm going to do...
If it's not broken, fix it until it is.
My Blog