Use file from Network Drive with Shared

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Use file from Network Drive with Shared

Post by dutch »

Dear All,

I've found the problem with open file from network drive with shared mode. How can I open it.

CURDIR() function is show

"Network\V4 on DUTCHEZ4"

I try to use this command but it doesn't work.

USE (CURDIR()+"\TEST") SHARED NEW

If I do not use SHARED, I can open it but not in shared mode

USE (CURDIR()+"\TEST") NEW

Best regards,
Dutch
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dutch,

Are you using Windows Mobile 2005 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Yes, WM5

Post by dutch »

Dear Antonio,

Yes, I use WM5 & HP IPAQ 2790. When I click on the program. It doesn't show anything but after I change my code to USE without SHARED or SHARE. The program is opened immediately.

Regards,
Dutch
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dutch,

Is SHARED is blocking or slowing down the USE process on a real Pocket PC, you may consider to build your application without SHARED clause.

You may use a workaround, like using temporary DBFs, or an external file to use it as semaphore to know when to lock/unlock other files from the PC.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear Antonio,

You mean I have to USE an EXCLUSIVE mode. How can I open the shared file. May I have an example open file as SEMAPHORE?

Best regards,
Dutch
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dutch,

> You mean I have to USE an EXCLUSIVE mode.

Yes. If Windows Mobile 2005 does not let you use the SHARED mode then you have no other choice.

> May I have an example open file as SEMAPHORE?

Very simple, you use an ascii file where you write the locked records info. i.e.: locks.txt where you have:
number of locks: 2
record 2300
record 3420

So before you are going to modify a record, you check locks.txt to see if your record is "locked". If not, then you increase the number of locked records and write the record number. When you are done, you modify locks.txt again to remove the locked record.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dutch,

Another possible workaround is to simulate a kind of client/server schema. You may have a file named tolock.txt and there you write the record you want to lock, and an app in the pc locks it for you.

In other words, you give instructions to a server application that modify the database for you. You may also use sockets instead an ascii file to comunicate with the "server".
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

I do not understand

Post by dutch »

Dear Antonio,

I don't understand "Lock.Txt". If this file is a main transaction file, you cannot use in exclusive for sure. If not how can you request for a lock record because you don't know what is the record number to lock. I you say WM5 cannot open with SHARE, I think the middle application (interface module) is the way out.

Best regards,
Dutch
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dutch,

> because you don't know what is the record number to lock.

RecNo()

> I you say WM5 cannot open with SHARE

According to Microsoft, Windows Mobile 2005 supports files sharing API functions, but as you report, you are experiencing troubles with it.

> I think the middle application (interface module) is the way out.

What is it the interface module ? Do you mean the client/server model I commented ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear Antonio,

No, Because I still use FW and Comix. I've plan to change database but not now.

> Recno() is means you have to open the database first but I cannot open with exclusive because everybody use the main transaction file.

The interface module means small program to communicate between PPC and Database on server. PPC will write a single database to request the information and Interface will read database on the server and return the information that PPC need. Another request is post transaction from PPC and Interface will post instead of PPC to database on server.

Best regards,
Dutch
Post Reply