473,695 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.Fo xApplication()
Fox.DefaultFile Path = sFoxproLocation
Fox.DoCmd("Do Abc.prg") 'this inserts some data in
newtable.DBF
Fox.DoCmd("Rele ase All")
Fox.DoCmd("Clos e All")
Fox.DoCmd("Clea r All")
Fox.Quit()
Fox = Nothing
ofrmRep.Visible = False 'This is for displaying the table data in a
crystal report ofrmRep.ShowDia log(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
3 2500
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**@discussio ns.microsoft.co m> wrote in message
news:43******** *************** ***********@mic rosoft.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.Fo xApplication()
Fox.DefaultFile Path = sFoxproLocation
Fox.DoCmd("Do Abc.prg") 'this inserts some data in
newtable.DBF
Fox.DoCmd("Rele ase All")
Fox.DoCmd("Clos e All")
Fox.DoCmd("Clea r All")
Fox.Quit()
Fox = Nothing
ofrmRep.Visible = False 'This is for displaying the table data in a
crystal report ofrmRep.ShowDia log(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
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**@discussio ns.microsoft.co m> wrote in message
news:43******** *************** ***********@mic rosoft.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.Fo xApplication()
Fox.DefaultFile Path = sFoxproLocation
Fox.DoCmd("Do Abc.prg") 'this inserts some data in
newtable.DBF
Fox.DoCmd("Rele ase All")
Fox.DoCmd("Clos e All")
Fox.DoCmd("Clea r All")
Fox.Quit()
Fox = Nothing
ofrmRep.Visible = False 'This is for displaying the table data in a
crystal report ofrmRep.ShowDia log(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
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**@discussio ns.microsoft.co m> wrote in message
news:C7******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2308
by: Steve Perry | last post by:
Hi, I have a large FoxPro table with an index that I need to be Queried from SQL Server by OLE.DB or ODBC. If I query the DBF directly a search takes 1 Minute +. Is there a way I can call the data from the table and use the existing FoxPro Index? Thanks Steve
13
13340
by: Simon Bailey | last post by:
I am a newcomer to databases and am not sure which DBMS to use. I have a very simplified knowledge of databases overall. I would very much appreciate a (simplifed) message explaining the advantages and disadvantages of both programs. Many Thanks Simon
2
6600
by: Salad | last post by:
OS = WinXP & Win98. Access = A97 & AXP Q1) Where can I find the VFP ODBC driver at Microsoft. I have been working developing an app in Access that will link to some DOS FoxPro tables. I have been doing my development work in A97 but the folks have AXP at their site. As near as I can tell, the FoxPro driver has been discarded from A97 and replaced with ODBC in A2K onward
0
1776
by: Salad | last post by:
My operating system is WinXP Pro. I have 1 gig of memory and the chip is an Intel Pentium 4. I am using Access97. A table has been supplied to me from an external source createdc from Visual FoxPro file, version 6.0. If I connect to it using File/GetExternalData/Link and select FoxPro as the file type and it links OK. I press Open and the table opens just like an Access table...quickly. There are 557 records. The problem is that...
1
3112
by: David Sorber via AccessMonster.com | last post by:
Hello, I've got two questions. Im writing an Access 2000 database to collect data from multiple Visual Foxpro Databases, total some figures, save the data into a table for archiving purposes, and be able print out a report. Im connecting to the Foxpro Databases using ODBC through VB version 6 and my Visual Foxpro Driver is dated at 12/7/1999 version 6.01. 1.When connecting to a particular Foxpro database my access program completely...
2
2165
by: Toco | last post by:
Hello. I have app written in C# that we are testing. The executable is shared on our network. The method we are testing is a call to a foxpro table. The call is made to query the table, then fill a datable with the resultset. All is fine when I run the executable from my machine. However, when our test user runsthe same executable, the app errors out when attempting to read from the foxpro table. I have logged where the user...
2
3376
by: cj | last post by:
We have a legacy accounting system (not developed in house) here that happens to be written in Visual FoxPro. One of the tables has an index that is actually a coded function COMPANY1 &&"G_RETSDX(COMPANY)". When I try to use this table in VFP I get an error message "File 'g_retsdx.prg' does not exist." I click ok and continue on. We've developed many VFP programs outside the accounting system that use this table and we have to include...
7
5490
by: z71mdridin | last post by:
I have an asp.net website that uses Form authentication to authenticate users. I need to provide users with a report based on FoxPro data that resides on a remote server. When I attempt to connect to the Foxpro directory by using the ODBC DSN that we currently use in ColdFusion, I get the following message: ERROR File 'table.dbf' does not exist. I know this is probably a permissions issue because asp.net is being
10
4776
by: Johny | last post by:
Is there a module for reading/modifing db files from Python? Thanks for help B.
0
8586
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9004
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6506
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4351
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4592
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1986
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.