> >
> > Cetin...thank you for your assistance.
> > I used the following:
> > Dim m_connString As String = "Provider=VFPOLEDB;Data Source=c:\database\"
> >
> > This connection string works fine IF I do NOT have the database opened in SHARE mode using VFP 9. When I do have it opened SHARE in VFP9 I get the same "cannot open the c:\database\main.dbc" error message. No difference from what I was getting.
> >
> > I am the only one using my computer and I only have 1 instance of VFP running and a "Display Status" shows the main.dbc opened. When opening main.dbc I used "Open Database main SHARED".
> >
> > Thanks again...other ideas? If there were some corruption with the main.dbc or missing tables/etc. from the directory (we use the same directory for the main.dbc and all tables/etc.) would that cause a problem like this? Also, the main.dbc was originally created with vfp 5.0 possibly. We jumped from 5.0 to 9sp2 last June 2008.
> > Ron
>
>
Open database main shared
> doesn't guarantee that it is opened shared. Double check if it is not opened exclusive:
>
>
Open database main shared
> ? IsExclusive('Main',2) && if opened shared you should get a .F.
>
>
> This happens (and not considered as a bug) when the database is already opened exclusive. ie:
>
>
set excluive on
> open database main
> set database to && assume these three lines are part of a startup and you don't notice
>
> open database main shared && no error and it is really set as current db
>
> ? IsExclusive('main',2) && prints .T. indicating that in fact you are using dbc in exclusive mode
>
> I use the same connection string (I prefer including dbname.dbc as long as I have one) with C# and
ASP.Net or in windows forms with no collision. My customers simultaneously update (I mean both types of users are supported during the day) the data using
ASP.Net and desktop VFP application.
>
> Cetin Basoz
Hi again Cetin,
Thank you for explaining this to me. I do not see the "IsExclusive()" command in the VFP9SP2 HELP list so I did not know it even existed. I now see it documented on MSDN as a VFP function.
Turns out what I was doing was:
1. Double-clicking on a vfp table (which was part of main.dbc) to launch VFP so the default directory would be where the database/tables were located.
2. Issue the USE command to close the table (since it would be opened exclusive)
3. Issue the OPEN database main SHARED command
Doing the above results in a .T. for isExclusive(). If I launch VFP by clicking on the VFP icon, change my default directory to c:\database (I don't really need to change default) and then OPEN database main SHARED I get a .F. for isExclusive().
So, doing step #1 above actually must open the database even though it does NOT appear in the details when I do a DISPLAY STATUS!!!
I will now test my asp code again...thank you,
Ron