Re: Feature is not available? by Anders
Anders
Mon May 12 14:10:17 CDT 2008
set up a connection with Exclusive=Yes
If the Open fails you're likely keeping the DBC open some place, and/or have
the table open somewhere. If you're in the VFP IDE, remember that the PM
keeps a connection open if any table in that database has been opened, or
you've used the PM to see the tables in the database all its own which you
can only close by selecting the database on the Data page of the PM and
hitting the Close button, or closing the PM.
This doesn't work in OLEDB as there are no workareas, alias or implicit
aliases.
USE table
PACK
PACK IN tablename
That's why there is a command "PACK tablename", just like the tablename is
specified in every SQL DML command.
It also works in VFP:
CLOSE ALL
PACK C:\tables\tests\temp.dbf
and the Pack command locates the table, opens it, copies it with SET DELETED
ON, renames the temp file (and leaves it open).
-Anders
"B. Chernick" <BChernick@discussions.microsoft.com> wrote in message
news:F965A7D4-91DC-42E5-BD18-910D2AA304B7@microsoft.com...
> Sorry about that. I meant to say that after running the program, the
> deleted
> records are still there. (I may have gotten past this immediate problem.
> More later.)
>
> "Dan Freeman" wrote:
>
>> Can you describe "not working"?
>>
>> Should we guess what you're actually seeing? <g>
>>
>> Dan
>>
>> B. Chernick wrote:
>> > I am using 'Pack <table name> but it's still not working.
>> >
>> > The complete command string at present is 'Use <table name>
>> > Exclusive; Pack <table Name>'
>> >
>> > Do I need something else? Some sort of close or release command? Is
>> > the connection.close enough?
>> >
>> > "Fred Taylor" wrote:
>> >
>> >> You need to use "PACK tablename" not just the "PACK" command like
>> >> when you're in VFP.
>> >>
>> >> --
>> >> Fred
>> >> Microsoft Visual FoxPro MVP
>> >>
>> >>
>> >> "B. Chernick" <BChernick@discussions.microsoft.com> wrote in message
>> >> news:F13730C8-BBC2-420E-82D4-FA30333E35E7@microsoft.com...
>> >>>
>> >>> A massive apology. I found the immediate problem. I left out the
>> >>> phrase 'Data Source='. Now the Open works.
>> >>>
>> >>> Still can't quite get the pack command to work. More later.
>> >>>
>> >>> "Paul Pedersen" wrote:
>> >>>
>> >>>> Typically that message will appear if you try to do something
>> >>>> that's not allowed in the runtime version (i.e., FoxPro is not
>> >>>> installed on the machine). Older Foxpro's like 6 were more picky
>> >>>> about that than 9.
>> >>>>
>> >>>> Is it possibly due to some code in the database? I forget what all
>> >>>> the forbidden features are/were, but some are: DEBUG, COMPILE, SET
>> >>>> STEP ON, things like that. If there are such commands in the db
>> >>>> procedures that automatically run on open, you might get that
>> >>>> message.
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> "B. Chernick" <BChernick@discussions.microsoft.com> wrote in
>> >>>> message news:D563964D-7253-4834-B6BC-0022A3DB154D@microsoft.com...
>> >>>>> On dc.open. Here's the actual code. sConnStr is the connection
>> >>>>> string described earlier.
>> >>>>>
>> >>>>> Dim dc As New OleDb.OleDbConnection(sConnStr)
>> >>>>> Try
>> >>>>> dc.Open()
>> >>>>> Catch ex As Exception
>> >>>>> MsgBox("Open Fails, error = " + ex.Message)
>> >>>>> Exit Sub
>> >>>>> End Try
>> >>>>>
>> >>>>> "Paul Pedersen" wrote:
>> >>>>>
>> >>>>>> What is the line that's causing the error?
>> >>>>>>
>> >>>>>>
>> >>>>>> "B. Chernick" <BChernick@discussions.microsoft.com> wrote in
>> >>>>>> message
>> >>>>>> news:14E43ECC-8BEB-4B8D-8AA4-21C23A550614@microsoft.com...
>> >>>>>>> I'm trying to write a quickie Winforms utility (VB, 2.0) that
>> >>>>>>> will pack
>> >>>>>>> some
>> >>>>>>> FoxPro 6 dbf tables. Unfortunately the same connection strings
>> >>>>>>> that worked
>> >>>>>>> with my web app don't seem to work in Winforms. It's crashing
>> >>>>>>> on open
>> >>>>>>> with a
>> >>>>>>> 'Feature is not available' message. (And yes I've already
>> >>>>>>> checked ConnectionStrings.com)
>> >>>>>>>
>> >>>>>>> I've tried a connection string of both:
>> >>>>>>> "Provider=VFPOLEDB.1;" + <file path> + ";Collating
>> >>>>>>> Sequence=General" (This is what I've been using in my web apps.)
>> >>>>>>> and
>> >>>>>>>
>> >>>>>>> "Provider=VFPOLEDB.1;DRIVER={Microsoft Visual FoxPro
>> >>>>>>> Driver};SourceType=DBF;" + <file path> +
>> >>>>>>> ";Exclusive=NO;BackGroundFetch=NO;NULL=NO;Collate=MACHINE"
>> >>>>>>>
>> >>>>>>> (got that one from ConnectionStrings.com)
>> >>>>>>>
>> >>>>>>> What am I missing?
>> >>>>>>>
>> >>>>>>> (Is there some reference I'm forgetting? Something extra
>> >>>>>>> needed in Winforms
>> >>>>>>> but not web apps???)
>>
>>
>>