Page 1 of 1

Opening DBFs error

Posted: Sat Oct 22, 2005 2:23 pm
by kronos911
Hello
I'm having some problems with an app that I'm recoding for windows. Although I'm using the right commands I cant seem to open a DBF file that is needed for my app.
The code snip that hase the problem is

Code: Select all

      DEFINE WINDOW oBrwsWin MDICHILD TITLE OemToAnsi("Εξερευνηση");
        OF oMainWin NOICONIZE NOZOOM NOCAPTION NOSYSMENU MENU BuildMenu()

      SELECT 1
      //SX_SETPASS( cIFTPwd, 1)
      USE FOLDERS VIA "SIXCDX" ALIAS FOLDER PASSWORD (cIFTPwd)
      MSGInfo(ALIAS())

@0,0 LISTBOX oLstBx1;
  FIELDS PADL(ALLTRIM(FOLDER->SIDE_A),4)+"/"+FOLDER->SIDE
         PADL(ALLTRIM(FOLDER->RED_A),4)+"/"+SUBSTR(FOLDER
         FOLDER->NAME,;
         FOLDER->ADDRESS,;
         FOLDER->TYPE;
    FIELDSIZES 20, 20, 150, 150, 80;
    HEADERS OemToAnsi("Πλαϊνο"), OemToAnsi("Αρ. Πρωτ"),;
            OemToAnsi("Ιδιοκτητης"), OemToAnsi("Ειδος");
    SIZE (oBrwsWin:nBottom-oBrwsWin:nTop),;
         (oBrwsWin:nRight - oBrwsWin:nLeft);
    OF oBrwsWin
The ALIAS function returns nothing. When I try to make a browse listbox the app crashes with to base/1002 Alias dose not exist FOLDER. In the error log there are no DBFs in use :?:
I'm using
Clipper 5.2e, Blinker 6, Six 3.02, and fivewin 1.92 demo.
What am I doing wrong?
Thanks

Posted: Sat Oct 22, 2005 5:38 pm
by Antonio Linares
Are you closing the DBF after activating the MdiChild window ? If so, don't close it and try it again.

Posted: Sat Oct 22, 2005 7:17 pm
by kronos911
No that DBF will be left open all through the app. It's funny all the sample apps that use DBFs work fine. Origanly I had the USE command under the LOCAL statment and before any line of code.

[EDIT]
Ok I did a "backstep" and used one of the older versions of the DBF. That version is an uncrypted DBFNTX file. The one I would like to use and is on the clients pc is a encrypted SIXCDX file. One other thing I saw was with the \samples\fwbrow.prg the app still dosen't open the file it just shows a blank (empty) box where the listbox should be.
If this is the case than I can't use FW because I want to have my DOS app as a safty net with out having to encrypt the new data again.

Posted: Sun Oct 23, 2005 5:04 am
by Antonio Linares
kronos911 wrote:One other thing I saw was with the \samples\fwbrow.prg the app still dosen't open the file it just shows a blank (empty) box where the listbox should be.
samples\fwbrow.prg works fine here. Have you modified it ? What FW version are you using ?

Posted: Sun Oct 23, 2005 6:49 am
by kronos911
First I tried it as is. Then I linked in six3.lib and added the USE ... PASSWORD command before the browse() function. I tried it with 1.92 demo. If you like send me a PM with an email that I can use to send you the file and you can try it out (source code too).

Posted: Sun Oct 23, 2005 9:19 am
by Antonio Linares
kronos911 wrote:First I tried it as is.
Did it work ok ? It should.
kronos911 wrote: Then I linked in six3.lib and added the USE ... PASSWORD command before the browse() function. I tried it with 1.92 demo
As far as I remember the six driver was buggy with Clipper. Does it work ok on MsDos mode ?

Posted: Sun Oct 23, 2005 12:29 pm
by kronos911
Antonio Linares wrote:Did it work ok ? It should.
With DBFNTX files yes. With my file no.
Antonio Linares wrote: As far as I remember the six driver was buggy with Clipper. Does it work ok on MsDos mode ?
For the last 3 monthes when I baught it (SIX3.LIB) and changed the RDD system of my dos app from DBFCDX to SIXCDX with encryption, all is ok and the dos app works fine. (The app has been running for the last 5 years using the DBFCDX RDD, but the user whanted encrypted data and now a new GUI)
Whith the sample app I can't even see the field headers. I just get a blank screen.
I'm going to try opening the DBFCDX version of my file with the SIXCDX with out encryption or onverting it.

Posted: Sun Oct 23, 2005 1:05 pm
by kronos911
Ok I found the problem. From the monthly backup files that I get somehow the dbf was readonly :?: :oops: I found that error out when I used the same dbf on my dos app and the dos #5 error came up. As I dont have it for multiuser and the system didn't crash I looked at the file with the attrib cmd. There it was R FOLDERS.DBF. :evil:
So this thread is closed and the demo app works fine (so far, what questions will come up down the road I don't know)

I do have one question how to trap the escape key so that it wont close an MDIchild window

Any way thank you for you replies.

Posted: Sun Oct 23, 2005 3:34 pm
by Antonio Linares
Kronos,

glad to know you found the problem. To avoid closing the MdiChild, use its VALID clause.

We do appreciate if you use a personal photo for your "avatar" instead of a drawing. Thanks.

Posted: Mon Oct 24, 2005 8:37 am
by Vladimir Grigoriev
I'd like to add that if you open a database enclose the corresponding statement in BEGIN SEQUENCE END SEQUENCE statements. There are only a few errors (02h, 03h, 05h and maybe one more error code) which concern with the file operations, so you can process all of them in your program and give informative messages to users.