Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File not open error
Message
De
11/12/2001 08:58:06
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00590976
Message ID:
00592610
Vues:
22
>>>Nope.
>>Then do :)
>>Cetin
>
>
>Still no luck
>
>I have this code
>
>DEFINE CLASS PriceWS AS Custom OLEPUBLIC 	
>	isOpen= .F.
>	cDir= ""
>	oDS= .F.
>	
>	FUNCTION Init
>		LOCAL oINI AS IniAccess OF PriceWS, ;
>			cDir AS String
>		SET CLASSLIB TO PriceWS
>		SET DATE TO BRITISH
>		SET RESOURCE OFF
>		SET EXCLUSIVE OFF
>		SET CPDIALOG OFF
>		SET DELETED ON
>		SET EXACT OFF
>		SET SAFETY OFF
>		SET REPROCESS TO 2 SECONDS
>		this.oDS= CREATEOBJECT("Session")
>		SET DATASESSION TO this.oDS.DataSessionID
>		oINI= CREATEOBJECT("IniAccess")
>		oINI.getinientry(@cDir, "MySection", "Dir", "MyIni.ini")
>		m.cDir= ADDBS(m.cDir)
>		IF !EMPTY(m.cDir)
>			this.cDir = m.cDir
>			this.isOpen= .T.
>			USE (m.cDir + "MyTable.dbf") IN 0 SHARED ORDER MyOrder
>		ENDIF
>	ENDFUNC
>	
>	FUNCTION getString AS String
>		RETURN "String"
>	ENDFUNC
>	
>ENDDEFINE
>

>
>Any Ideas?
>All files and the like exist, and all code works in the command window.
>When attempting to create an instance it say Class Factory can not provide the class.
>If I comment out
>USE (m.cDir + "MyTable.dbf") IN 0 SHARED ORDER MyOrder
>Then it instanciates fine

Chris,
If myOrder is not an external IDX file (I guess it's not - but a tag of structural CDX) :

use (m.Cdir+"myTable.dbf") in 0 shared order TAG myOrder

It explains 'File not open' (myOrder.IDX is missing).
For 'Classfactory' thing it's not that line but there is some devil thing in your code causing it (possibly an unprintable char - I didn't check with a hexeditor) not the code itself. When I tried with your code I got the same thing and when I created a new file manually it worked succesfully (see below - code is essentially same as yours). BTW in your code Datasession was not private so I changed a little bit :
Define class PriceWS as custom OlePublic
  isOpen= .F.
  cDir= ""
  oDS= .F.

  Procedure init
  Local oINI, cDir
  This.oDS=CreateObject('PrivateSess')
  Set DATASESSION TO this.oDS.DataSessionID
*		oINI= CREATEOBJECT("IniAccess")
*		oINI.getinientry(@cDir, "MySection", "Dir", "MyIni.ini")
  m.cDir = sys(5)+curdir() && Was on a dir where customer.dbf reside
  m.cDir= ADDBS(m.cDir)
  If !EMPTY(m.cDir)
    This.cDir = m.cDir
    This.isOpen= .T.
    Use (m.cDir + "customer.dbf") IN 0 SHARED ORDER tag cust_id
  Endif
Endproc

  Procedure GetDataField
  Lparameters tcKey, tcField
  If seek(tcKey, 'customer','cust_id')
    Return eval('Customer.'+tcField)
  Else
    Return .null.
  Endif
Endproc

  Procedure _getString
  Return "String"
Endproc
Enddefine

Define class PrivateSess as Session
  DataSession=2
  Procedure Init
  Set DATE TO BRITISH
  Set RESOURCE OFF
  Set EXCLUSIVE OFF
  Set CPDIALOG OFF
  Set DELETED ON
  Set EXACT OFF
  Set SAFETY OFF
  Set REPROCESS TO 2 SECONDS
Endproc

Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform