By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

foxpro table hosed up when called 2nd time from VB.net

P: n/a
I have a abc.PRG file in visual foxpro 8.0. I can run this file using visual
foxpro environment and it creates a table X.dbf in the same folder where
this program file is and populates some data in the table. I am now using
VB.NET to run this abc.PRG file through VB.net environment. (Equivalent
method to perform same as "DO abc.prg" command in foxpro).
My code for this is as below. This code runs on click of a button in Vb.net.:

Dim Fox As New VisualFoxpro.FoxApplication()
Fox.DefaultFilePath = sFoxproLocation
Fox.DoCmd("Do Abc.prg") 'this inserts some data in
newtable.DBF
Fox.DoCmd("Release All")
Fox.DoCmd("Close All")
Fox.DoCmd("Clear All")
Fox.Quit()
Fox = Nothing
ofrmRep.Visible = False 'This is for displaying the table data in a
crystal report ofrmRep.ShowDialog(iReport)
iReport = 0

All the above works fine. Abc.prg runs well and creates a new table in
foxpro. Now, my VB.NET program has a crystal report that uses this generated
table and displays data from it. I get to see the report good too.all this
for the first time i click the button. Now i close my crystal report.
But when i try and click the button again now, it gives me an error saying
"File access is denied e:\newtable.DBF"
Can someone please help me. Thanks in advance!
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Amar,

It doesn't sound like your FoxPro table is "hosed" (as in "broken") it
sounds like it's merely in use somewhere else and you are trying to open it
in Exclusive mode.

You say that you close the Crystal Report. Is CR still running in the
background? What happens if you create the table and run the CR. Then close
everything (and maybe even restart your machine so you know nothing else is
running) and then run just the CR with the table already present and without
running the table creation code?
--
Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
ci**************@msn.com www.cindywinegarden.com
Blog: http://spaces.msn.com/members/cindywinegarden
"Amar" <Am**@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
I have a abc.PRG file in visual foxpro 8.0. I can run this file using
visual
foxpro environment and it creates a table X.dbf in the same folder where
this program file is and populates some data in the table. I am now using
VB.NET to run this abc.PRG file through VB.net environment. (Equivalent
method to perform same as "DO abc.prg" command in foxpro).
My code for this is as below. This code runs on click of a button in
Vb.net.:

Dim Fox As New VisualFoxpro.FoxApplication()
Fox.DefaultFilePath = sFoxproLocation
Fox.DoCmd("Do Abc.prg") 'this inserts some data in
newtable.DBF
Fox.DoCmd("Release All")
Fox.DoCmd("Close All")
Fox.DoCmd("Clear All")
Fox.Quit()
Fox = Nothing
ofrmRep.Visible = False 'This is for displaying the table data in a
crystal report ofrmRep.ShowDialog(iReport)
iReport = 0

All the above works fine. Abc.prg runs well and creates a new table in
foxpro. Now, my VB.NET program has a crystal report that uses this
generated
table and displays data from it. I get to see the report good too.all this
for the first time i click the button. Now i close my crystal report.
But when i try and click the button again now, it gives me an error saying
"File access is denied e:\newtable.DBF"
Can someone please help me. Thanks in advance!

Nov 21 '05 #2

P: n/a
Hi Cindy,
Thanks for helping me earlier and now too.
I think i confused you. Let me rephrase my problem.
Well i have all my applications closed. Now i start my VS.net and run my
vb.net application in debug mode. On this application i have a button that
runs a .PRG file in foxpro which in turn creates a DBF table in foxpro and
inserts a few rows in it. Then i close the table and release everything at
the end of the .PRG run. My control returns to the .NET application wherein i
close the foxpro object that i have used (as seen in the code that i sent
yesterday). Then i call my crystal reports which uses this newly created
table and displays a report. I close this report.
Now again i click the button on the application which does all the steps
again as above. But this time it fails saying that table is in use. I dont
understand why the table is in use when i have closed the report.
Cud you please suggest me some example code as to close the table after
closing the report? or any other option is welcome.
Thanks,
Amar

"Cindy Winegarden" wrote:
Hi Amar,

It doesn't sound like your FoxPro table is "hosed" (as in "broken") it
sounds like it's merely in use somewhere else and you are trying to open it
in Exclusive mode.

You say that you close the Crystal Report. Is CR still running in the
background? What happens if you create the table and run the CR. Then close
everything (and maybe even restart your machine so you know nothing else is
running) and then run just the CR with the table already present and without
running the table creation code?
--
Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
ci**************@msn.com www.cindywinegarden.com
Blog: http://spaces.msn.com/members/cindywinegarden
"Amar" <Am**@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
I have a abc.PRG file in visual foxpro 8.0. I can run this file using
visual
foxpro environment and it creates a table X.dbf in the same folder where
this program file is and populates some data in the table. I am now using
VB.NET to run this abc.PRG file through VB.net environment. (Equivalent
method to perform same as "DO abc.prg" command in foxpro).
My code for this is as below. This code runs on click of a button in
Vb.net.:

Dim Fox As New VisualFoxpro.FoxApplication()
Fox.DefaultFilePath = sFoxproLocation
Fox.DoCmd("Do Abc.prg") 'this inserts some data in
newtable.DBF
Fox.DoCmd("Release All")
Fox.DoCmd("Close All")
Fox.DoCmd("Clear All")
Fox.Quit()
Fox = Nothing
ofrmRep.Visible = False 'This is for displaying the table data in a
crystal report ofrmRep.ShowDialog(iReport)
iReport = 0

All the above works fine. Abc.prg runs well and creates a new table in
foxpro. Now, my VB.NET program has a crystal report that uses this
generated
table and displays data from it. I get to see the report good too.all this
for the first time i click the button. Now i close my crystal report.
But when i try and click the button again now, it gives me an error saying
"File access is denied e:\newtable.DBF"
Can someone please help me. Thanks in advance!


Nov 21 '05 #3

P: n/a
Hi Amar,

Yes, I understood all of that. You need to figure out if the table is
"broken" or just open somewhere. Running your report a second time after
restarting your machine will help you decide this. If the table is ok then
you must have it open somewhere and your CR must be trying to open it
exclusively. I don't have a lot of experience with Crystal Reports so I
don't know how it opens and closes tables. Also, I believe CR can access
Fox2.x tables natively, but must use ODBC for tables using newer data
features.
--
Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
ci**************@msn.com www.cindywinegarden.com
Blog: http://spaces.msn.com/members/cindywinegarden
"Amar" <Am**@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Hi Cindy,
Thanks for helping me earlier and now too.
I think i confused you. Let me rephrase my problem.
Well i have all my applications closed. Now i start my VS.net and run my
vb.net application in debug mode. On this application i have a button that
runs a .PRG file in foxpro which in turn creates a DBF table in foxpro and
inserts a few rows in it. Then i close the table and release everything at
the end of the .PRG run. My control returns to the .NET application
wherein i
close the foxpro object that i have used (as seen in the code that i sent
yesterday). Then i call my crystal reports which uses this newly created
table and displays a report. I close this report.
Now again i click the button on the application which does all the steps
again as above. But this time it fails saying that table is in use. I dont
understand why the table is in use when i have closed the report.
Cud you please suggest me some example code as to close the table after
closing the report? or any other option is welcome.
Thanks,
Amar

"Cindy Winegarden" wrote:
Hi Amar,

It doesn't sound like your FoxPro table is "hosed" (as in "broken") it
sounds like it's merely in use somewhere else and you are trying to open
it
in Exclusive mode.

You say that you close the Crystal Report. Is CR still running in the
background? What happens if you create the table and run the CR. Then
close
everything (and maybe even restart your machine so you know nothing else
is
running) and then run just the CR with the table already present and
without
running the table creation code?

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.