First time tDataBase user

First time tDataBase user

Postby DonDrew » Mon Feb 11, 2013 11:47 am

Attempting for the first time to use database objects.

Applying the example in dbf01.prg I inserted the following 2 lines of code in my program:

USE Customer

DATABASE oDbf

It compiles cleanly but invariably returns the following error at runtime:

Error description: Error BASE/44 Assigned value is wrong class: TDATABASE:CALIAS
Args:
[ 1] = C CUSTOMER

What am I missing?

Don
DonDrew
 
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Re: First time tDataBase user

Postby Antonio Linares » Mon Feb 11, 2013 1:51 pm

Don,

Please run this:

USE Customer

MsgInfo( Alias() )
MsgInfo( ValType( Alias() ) )

DATABASE oDbf

What FWH version are you using ? Are you using modified FiveWin classes of your own ?
regards, saludos

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

Re: First time tDataBase user

Postby DonDrew » Mon Feb 11, 2013 2:43 pm

Antonio,

Msginfo(Alias()), response CUSTOMER
Msginfo(Alias()), response C

FWH v 6.12
No, I haven't modified any part of FW. With my limited skills, I'd only create serious problems.

Thanks, Don
DonDrew
 
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Re: First time tDataBase user

Postby James Bott » Mon Feb 11, 2013 4:07 pm

Can you compile and run dbf01.prg?

Did you possibly have the customer.dbf file already open in another program?

Also, instead of this line:

DATABASE oDBF

Try this:

oDbf := TDataBase():New()

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: First time tDataBase user

Postby DonDrew » Mon Feb 11, 2013 6:43 pm

No, I haven't compiled dbf01.

oDBF := tDataBase():New() produces the same error,

Error BASE/44 Assigned value is wrong class: TDATABASE:CALIAS
Args:
[ 1] = C CUSTOMER

The only header I'm using is FiveWin.ch. Am I missing something? Should I be linking with a special LIB?
DonDrew
 
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Re: First time tDataBase user

Postby Antonio Linares » Mon Feb 11, 2013 9:33 pm

Don,

Please try this change in database.prg:

DATA cAlias, cFile // AS String INIT ""

and recompile database.prg, create database.obj and replace it in your fiveh.lib this way:

c:/bcc55/bin/tlib fiveh.lib -+ database.obj
regards, saludos

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

Re: First time tDataBase user

Postby James Bott » Mon Feb 11, 2013 11:16 pm

Don,

No, I haven't compiled dbf01.


Please try this. If it works OK, then the problem is in your code. If not, then the problem is elsewhere (compiler, linker, ch files, your code, fwh).

James
Last edited by James Bott on Tue Feb 12, 2013 12:29 am, edited 1 time in total.
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: First time tDataBase user

Postby DonDrew » Mon Feb 11, 2013 11:36 pm

Antonio,
Changed DataBase.prg as instructed but cannot add it to FiveH.lib because my MS and Pelles librarians are reporting problems with the LIB.

I hadn't been linking FiveH.lib to my application before now so I added it to my link script. The MS linker is reporting that it's corrupt. I reinstalled FiveH.lib from my original FiveWin distribution and both librarians and the MS linker are reporting problems with it.
DonDrew
 
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Re: First time tDataBase user

Postby Antonio Linares » Mon Feb 11, 2013 11:45 pm

Don,

What C compiler and version are you using ?

Please post here the errors that you get, thanks
regards, saludos

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

Re: First time tDataBase user

Postby DonDrew » Tue Feb 12, 2013 4:58 pm

My compiler is Microsoft so I made the changes suggested by Antonio to FiveHM.lib. I then compiled a copy of dbf01.prg. Running the program with the modified FiveHM.lib the program crashed with the error:

Error description: Error BASE/44 Assigned value is wrong class: TDATABASE:BBOF
Args:
[ 1] = B {|| ... }

Stack Calls
===========
Called from: => TDATABASE:_BBOF(0)
Called from: dbf01.prg => TDATABASE:NEW(161)
Called from: dbf01.prg => CLIENTSBROWSE(182)
Called from: dbf01.prg => (b)BUILDMENU(42)
Called from: => TMENU:COMMAND(0)
Called from: => TWINDOW:COMMAND(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: => TWINDOW:ACTIVATE(0)
Called from: dbf01.prg => MAIN(25)


I the relinked with the original version of Fivehm.lib which of course returned my original error:
Error description: Error BASE/44 Assigned value is wrong class: TDATABASE:CALIAS
Args:
[ 1] = C CUSTOMER

Stack Calls
===========
Called from: => TDATABASE:_CALIAS(0)
Called from: dbf01.prg => TDATABASE:NEW(0)
Called from: dbf01.prg => CLIENTSREC(64)
Called from: dbf01.prg => (b)BUILDMENU(39)
Called from: => TMENU:COMMAND(0)
Called from: => TWINDOW:COMMAND(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: => TWINDOW:ACTIVATE(0)
Called from: dbf01.prg => MAIN(25)

What am I missing?
DonDrew
 
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Re: First time tDataBase user

Postby Antonio Linares » Tue Feb 12, 2013 7:26 pm

regards, saludos

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

Re: First time tDataBase user

Postby DonDrew » Tue Feb 12, 2013 8:23 pm

Antonio,
Thank for for the new version of Fivehm.lib.

I linked it into dbf01.exe and my own application. Both applications simply end abruptly without any error message.

I modified dbf01.prg:

msginfo("ready to try") <-- this line works.

USE Customer

msginfo(Alias()) <-- this line works.

DATABASE oDbf // We create a DBF Object based on the current Alias
// Now we can change WorkArea and the DBF Object
// automatically access its area !

msginfo("that line worked!") <-- the program ends abruptly before executing this line.
DonDrew
 
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Re: First time tDataBase user

Postby Antonio Linares » Tue Feb 12, 2013 9:39 pm

Don,

Please check if there is a *.log file in the same folder where the exe is
regards, saludos

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

Re: First time tDataBase user

Postby DonDrew » Tue Feb 12, 2013 10:00 pm

I have the usual Make and Link logs, nothing more.
DonDrew
 
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Re: First time tDataBase user

Postby DonDrew » Sat Feb 16, 2013 3:08 pm

Antonio,
Could you possibly send me a copy of the modified DataBase.prg you used to create the special version of Fivehm.lib you sent me the other day?

I'd like to experiment with it on my own to see what I can learn about the tDataBase class and perhaps find the reason it's not working on my system.

Don
DonDrew
 
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 6 guests