Re: OLE DB from .NET/open & close connections

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Bernhard,

Firstly, thank you.

The 'oCmd.CommandText = "SELECT tableTwo"' threw an exception of "No table
is open
in the current workarea" (curious!). But the 'oCmd.CommandText = "PACK IN
tableTwo"'
did the trick.

Without people like you my life would be constant confusion.

Thanks again,
Marc



"Bernhard Sander" <fuchs@xxxxxxx> wrote in message
news:uGrSQ$vGHHA.924@xxxxxxxxxxxxxxxxxxxxxxx
Hi Marc,

I've started working with FoxPro tables from VB.NET and I found that when
deleting and packing
two tables in succession, I have to close and then re-open the
connection, otherwise the second
pack statement doesn't execute and 'tableTwo' is still populated with the
deleted records.

Is there a better way, or is this just necessary due to the behavior?

Basically this is what I am doing:

oConn.open()
oCmd.CommandText = "DELETE FROM tableOne WHERE key = 10"
oCmd.ExecuteNonQuery()
oCmd.CommandText = "PACK"
oCmd.ExecuteNonQuery()
oConn.close()

oConn.open()
oCmd.CommandText = "DELETE FROM tableTwo"
oCmd.ExecuteNonQuery()
oCmd.CommandText = "PACK"
oCmd.ExecuteNonQuery()
oConn.close()
Just a guess:
after the DELETE FROM tabelTwo and before the PACK, maybe add this:
oCmd.CommandText = "DELETE FROM tableTwo"
oCmd.ExecuteNonQuery()
oCmd.CommandText = "SELECT tableTwo"
oCmd.ExecuteNonQuery()
oCmd.CommandText = "PACK"
...

Background: Foxpro uses some a workspace for every table it opens. One of
these workspaces is the "active workspace". A SQL command opens the
necessary tables in unused workspaces. It seems, when foxpro opens the
first table in a session, it opens the table in the active workspace. The
next table(s) are opened in other free workspaces, but these workspaces
don't become active. You can select the active workspace with the
mentioned SELECT command. This syntax is not SQL syntax but foxpro syntax.
Another way to pack the second table would be:
oCmd.CommandText = "PACK IN tableTwo"
With this command you tell foxpro to pack the table of a different
workspace than the active workspace.

Regards
Bernhard Sander


.



Relevant Pages

  • Re: OLE DB from .NET/open & close connections
    ... pack statement doesn't execute and 'tableTwo' is still populated with the deleted records. ... Foxpro uses some a workspace for every table it opens. ... It seems, when foxpro opens the first table in a session, it opens the table in the active workspace. ...
    (microsoft.public.fox.programmer.exchange)
  • Yet another blonde joke
    ... Three men worked on a building site, a Mexican, an English man and a blonde ... The English man opens his pack. ...
    (uk.rec.humour)
  • Re: Word 2007 Document Management pane help
    ... Login with Windows Live ID to your Workspace and open a document EDIT and then when it has opened in Word on your Active Screen from the Sharepoint Server you can go to Word Pizza Button top left and select SERVER and open the Document Management pane and you will see the name of the Sharepoint path to your open document. ... I just want to get everything in the document management task pane to ... Document Management task pane opens ...
    (microsoft.public.word.docmanagement)
  • Re: Office Compatibility Pack cannot open docx file
    ... you don't have to install IE 7.0). ... pack to work. ... version of the Compatibility Pack?". ... a new page opens to the Office ...
    (microsoft.public.office.misc)
  • Re: Puzzler of the day... week???
    ... your system to locate them unless you have WinZip. ... > than Pack and Go to ensure full compliance with the End User License ... >> autorunning from a CD. ... >> Menu file opens fine, ...
    (microsoft.public.powerpoint)