Re: Select from open view using DBF()

From: Ron Weldy (ronweldy_at_msn.com)
Date: 01/29/05

  • Next message: Josh Assing: "Re: Select from open view using DBF()"
    Date: Fri, 28 Jan 2005 22:40:41 -0800
    
    

    Hmmm... but that's an alias. You are not using a view out of a database.
    Maybe that's the difference. Or it could be that I have set the TMPFILES
    term in my config.fpw like this:
    TMPFILES=C:\TEMP

    So you created an alias like this?

    USE mytable ALIAS myalias

    If so, dbf() should have returned your table name...

    At any rate as I mentioned I'm using a parameterized view in a database. For
    example let's call it myview. I suppose I could write some code to create
    one but if you have a database with a parameterized view, set your variable
    and use it like this:

    lctheparameter = "parameter"
    USE mydatabase!v_myview
    SELECT * from DBF("v_myview")

    This will bring up the open dialog when I execute this code.

    Now, you mentioned Create Cursor and that inspired me to write this, which
    does replicate the error:

    CREATE CURSOR mytable (somefield c(10))
    INSERT INTO mytable (somefield) VALUES ("test1")
    SELECT * from DBF("mytable")

    So you may be asking "Why does this dude want to select from the temp file,
    why not just write

    SELECT * from v_myview

    and call it good?"

    Let's say you buffer the view, and changes get made but they are not updated
    using TABLEUPDATE. If you SELECT from the view name like I have above, you
    will not see any un-saved changes as VFP appears to do a USE AGAIN and
    selects from a new instance of the view. In fact, I think this is documented
    in the KB and this method is the suggested workaround. I'll be darned if I
    can find that article though...

    I have worked around it by using copy to array and other commands, but it
    would be easier and much more powerful if you could SELECT from a open,
    buffered view. I suppose I could always report it if I go to the trouble of
    coding it... unless they fixed this in 9.0 or there is some command or
    method I don't know about. I'm using 8.0, btw.

    Thanks for the chat!

    - Ron

    "Josh Assing" <xjoshx@jassing.com> wrote in message
    news:lf8mv0pmcimc9tiirn9ktu46gmdgap4j1k@4ax.com...
    > Can you provide code that replicates it?
    >
    > I just created an alias -- and did a select from dbf("MyAlias")
    >
    > the file it refers to does not exist (no big suprise here) -- and the
    > select
    > worked fine...
    >
    > What VFP? an d code to replicate it would be handy... (Create cursor)
    > becuase my steps worked w/o error.
    >
    > On Fri, 28 Jan 2005 13:24:00 -0800, "Ron Weldy" <ronweldy@msn.com> wrote:
    >
    >>I simplified it while testing with the view open and executed it in the
    >>command window using:
    >>
    >>SELECT * from DBF("v_myview")
    >>
    >>A straight DBF("v_myview") will return a file name of
    >>c:\temp\J2GO003U.TMP,
    >>but this file does not exist when looking at the temp folder. I also did a
    >>search using windows explorer but could not find the file.
    >>
    >>
    >>"Josh Assing" <xjoshx@jassing.com> wrote in message
    >>news:cv9lv0t2ocvvplcpa6p4lvh6o95ri2pta0@4ax.com...
    >>>
    >>> what is your statement?
    >>>
    >>> On Fri, 28 Jan 2005 11:52:26 -0800, "Ron Weldy" <ronweldy@msn.com>
    >>> wrote:
    >>>
    >>>>I am trying to SELECT from an open view using the DBF() function and it
    >>>>errors saying 'table does not exist'. Interestingly enough, when I look
    >>>>for
    >>>>the tmp file name that DBF() returns, I can't find it either. Anyone
    >>>>know
    >>>>what's going on or how to do this?
    >>>>
    >>>
    >>>
    >>> ---
    >>> Remove x's to send.
    >>
    >
    >
    > ---
    > Remove x's to send.


  • Next message: Josh Assing: "Re: Select from open view using DBF()"

    Relevant Pages

    • Re: Problem on quering Access link table
      ... Is "Alias" a field in the Exchange table? ... > simply test the recordset for BOF/EOF? ... > Access Database Samples: www.rogersaccesslibrary.com ... I wrote ASP code to use Alias ...
      (microsoft.public.access.queries)
    • Re: SCR and Replay Queue length
      ... Are you also able to get the file attributes for the seeding directory using attrib? ... This posting is provided "AS IS" with no warranties, ... Please do not send email directly to this alias. ... > permon when trying to seed the database and didn't see anything out of> the ...
      (microsoft.public.exchange.admin)
    • Re: Priv1.edb and stm size cannot reduce after eseutil /d
      ... it would mount with blank a database. ... Please do not send e-mail directly to this alias. ... it was four o'clock by the time I got the defrag copy on to ... > the drive, if I had mistype the name, would the services start again? ...
      (microsoft.public.exchange.admin)
    • Re: Serious errors with Create view command
      ... Either you open each view as needed with a different alias and assign this ... stored in the database, ... Edit Stored Procedures opens a code editing window and saves the code you ... can't paste it INTO the view designer sql view window as that's Read ...
      (microsoft.public.fox.helpwanted)
    • Re: List Users Permissions down to table.column action
      ... THIS STORED PROCEDURE GENERATES COMMANDS ... -- FIXED PROBLEMS WITH STATEMENT LEVEL PERMISSIONS GRANTING. ... -- CREATE TABLE TO HOLD LIST OF USERS IN CURRENT DATABASE ... -- GRANT USER ACCESS TO SERVER ROLES ...
      (microsoft.public.sqlserver.security)