Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with TABLEUPDATE
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00720907
Message ID:
00722558
Vues:
28
I think that commented code was a little misleading - I had put that there in an effort to fix it! - this is what I have in a method called mopendatabase... this is what I call from VB passing the parameters in the call...

Ignore references to ACC, MSDE, SQL as I may be being a bit adventurous - it's with a view to using different database engines in the future...
LPARAMETERS strDBName, strDBPath, strDBType
LOCAL strDBNameShort, intLength
WITH thisform 
* test for a data path
IF EMPTY(strDBType) OR VARTYPE(strDBType) <> "C" THEN && no database type passed
RETURN -5
ENDIF 
IF EMPTY(strDBPath) OR VARTYPE(strDBPAth) <> "C" THEN
RETURN -1 && no path
ELSE
strDBPath = ADDBS(strDBPath)
.pdatapath = strDBPath
SET DEFAULT TO "&strDBPath" && get into the data folder
ENDIF
* test what type of database we are working with
DO CASE  
CASE ALLTRIM(UPPER(strDBType)) == "VFP"
* test for a valid database name
IF EMPTY(strDBName) OR VARTYPE(strDBName) <> "C" THEN 
RETURN -2 && no database name
ELSE
IF ".DBC" $ UPPER(strDBName) THEN && check it's a valid database name
intLength = LEN(strDBName)
strDBNameShort = SUBSTR(strDBName, 1, (intLength - 4))
IF FILE(strDBPath + strDBName) THEN && database exists - open it
IF NOT DBUSED("'" + strDBName + "'") THEN 
OPEN DATABASE (strDBName) SHARED
ENDIF 
SET DATABASE TO (strDBNameShort)
.msetdataenvironment()
.mopentables(strDBPath)
RETURN 1
ELSE 
RETURN -4 && database does not exist
ENDIF 	
ELSE
RETURN -3 && invalid database name
ENDIF
ENDIF
CASE ALLTRIM(UPPER(strDBType)) == "ACC"
CASE ALLTRIM(UPPER(strDBType)) == "MSDE"
CASE ALLTRIM(UPPER(strDBType)) == "SQL"
OTHERWISE 
RETURN -6 && invalid database type passed
ENDCASE 
ENDWITH
this is in msetdataenvironment
SET DATE BRITISH
SET TALK OFF
SET CENTURY ON
SET EXCLUSIVE OFF
SET MULTILOCKS ON
SET EXACT ON
SET DELETED ON
RETURN .T.
and this is in mopentables
LPARAMETERS strDBPath
* open tables for this object
IF !USED('sysoptions') THEN 
	USE (strDBPath + "sysoptions") IN 0 ALIAS sysoptions SHARED
ENDIF 
SELECT sysoptions
CURSORSETPROP("Buffering", 5, "sysoptions") && set optimistic row buffering on
LOCATE 
thisform.pMainTable = "sysoptions"
RETURN .t.
I would try opening the database and tables in the LOAD but I am not sure how to pass to the INIT of the form the info it needs ie: path to the database and table name to open. This is how I am instansiating the object in VB...
Dim oHub As New datahub.dhsys
If I try and add anything to end of this statement I get "End of statement expected"

I don't know if this helps or not - thanks again for your help - I will keep trying different approaches until it works - will let you know what fixes it!
Chris Maiden
Email
Web
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform