Page 1 of 1

Use file from Network Drive with Shared

PostPosted: Sat Sep 02, 2006 10:23 pm
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

PostPosted: Sat Sep 02, 2006 11:08 pm
by Antonio Linares
Dutch,

Are you using Windows Mobile 2005 ?

Yes, WM5

PostPosted: Sun Sep 03, 2006 5:06 am
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

PostPosted: Sun Sep 03, 2006 5:59 am
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.

PostPosted: Sun Sep 03, 2006 7:58 am
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

PostPosted: Sun Sep 03, 2006 8:50 am
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.

PostPosted: Sun Sep 03, 2006 8:55 am
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".

I do not understand

PostPosted: Sun Sep 03, 2006 9:00 am
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

PostPosted: Sun Sep 03, 2006 10:57 am
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 ?

PostPosted: Sun Sep 03, 2006 11:22 am
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