Information générale
Catégorie:
Crystal Reports
Bernhart,
Thanks for the info... but this requires a DSN correct? I'm trying to do it without a DSN. Let me know if I read it wrong....
Shawn
>Shawn,
>I connect my data without connection ADO but i use SetLogOnInfo()
>
>Look at code Ci below.
>I hope that this code will be able to help you.
>
> *---------------------------------------------------------------------------------------------------
> *-- Change the data source of a report at runtime.
> PROCEDURE changedataSource
> *------------------------------------------------------------------------------------------------
> LPARAMETERS cNewODBC, cTableName, cNewTableName
>
> *
> * cNewODBC ODBC DSN to use for this run
> * cTableName Name of the table this is to be applied to
> * cNewTableName New name of table if appropriate
> *
> LOCAL nItems, lSuccess
> lSuccess = .F.
> IF VARTYPE(cNewODBC) # 'C' OR VARTYPE(cTableName) # 'C'
> RETURN lSuccess
> ENDIF
> IF EMPTY(cNewTableName)
> cNewTableName = cTableName
> ENDIF
>
>
> *
> * Ensure '.dsn' is not included - also remember the ODBC name is CaSe SeNsItIvE
> *
> cNewODBC = STRTRAN( cNewODBC, '.dsn', '')
>
> WITH THIS.crreport
> nItems = .DATABASE.TABLES.COUNT
>
> FOR nX = 1 TO nItems
> *
> IF UPPER( ALLTRIM( .DATABASE.TABLES.ITEM( nX ).Location ) ) = cTableName
> * WAIT WINDOW "Connection Serveur Ok " TIMEOUT 4
> .DATABASE.TABLES.ITEM( 1 ).SetLogOnInfo(cNewODBC, "", "", "")
> .DATABASE.TABLES.ITEM( 1 ).Location = cNewTableName
> lSuccess = .T.
> EXIT FOR
> ENDIF
> ENDFOR
>
> ENDWITH
>
> RETURN lSuccess
> ENDPROC
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement