Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connecting To VFP Database Using VFPOLEB
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01305538
Message ID:
01305557
Vues:
10
The following works for me
lcDbc = "C:\Program Files\microsoft visual foxpro 9\Samples\Data\testdata.dbc "
lcConnStr = "DRIVER=Microsoft Visual FoxPro Driver; " + ;
			"Deleted=Yes; Null=Yes; Collate=Machine; " + ;
			"BackgroundFetch=No ; " + ;
			"Exclusive=No; " + ;
			"SourceType=DBC; " + ;
			"SourceDB=" + lcDbc

lnConn = SqlStringConnect(lcConnStr)
IF lnConn < 0
	? "Connection error"
	? _processodbcerror()
	RETURN
ENDIF

TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 7
SELECT * FROM Products 
ENDTEXT	

lnResult = SQLEXEC(lnConn , lcSql )

IF lnResult < 0
	? _processodbcerror()
	RETURN
ENDIF

BROWSE NOWAIT
>
>I tried this
>
>
>CLEAR
>
>sDatabase = "C:\Projects\mydatabase.dbc"
>sConnString = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB="+sDatabase+";
Exclusive=No; NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;"
>
>iHandle = SQLCONNECT(sConnString, .T.)
>
>IF iHandle > 0
>
>	? "Connect"
>	
>	SQLDISCONNECT(iHandle)
>
>ELSE
>
>	? "Unable to connect"
>	AERROR(aErrInfo)
>	? aErrInfo[1]
>	? aErrInfo[2]
>	
>	_cliptext = aErrInfo[2]
>	
>ENDIF
>
>
>I got "Connectivity error: [Microsoft][ODBC Driver Manager] Data source name too long"
>
>I got the connection string info from http://www.connectionstrings.com/?carrier=visualfoxpro
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform