Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Crystal report 10 ( Modify database location at runtime using CrystalRuntime.Application.10 )

Crystal report 10 ( Modify database location at runtime using CrystalRuntime.Application.10 )

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AkiraOne
    wrote on last edited by
    #1

    Hi All. With Crystal report 10 I go to generate the report file and through the DLL to runtime I go to modify the logon parameters.... With this code I go to set up the parameters of logon of the report...but there is a problem when I set password ConnectionProperty has not been set..only password connection property....:mad:

    void CDlgRptConnectionProperty::OnBnClickedOk()
    {
    _bstr_t bstParameterName,
    bstParameterValue;
    _variant_t vtValue;

    IConnectionPropertyPtr pConnectionProperty = NULL;
    IDatabaseTablesPtr pDatabaseTables = NULL;
    INameValuePairsPtr pNameValuePairs = NULL;
    IDatabasePtr pDatabase = NULL;
    \_bstr\_t bstConnection;
    HRESULT hr;
    
    try {
    	
    	// Puntatore interfaccia tabelle
    	pDatabaseTables = m\_pReport->GetDatabase()->GetTables();
    
    	// Puntatore parametri di connessione tabella
    	IDatabaseTablePtr pDatabaseTable = pDatabaseTables->GetItem(1);
    	pNameValuePairs = pDatabaseTable->GetConnectionProperties();
    
    	if( (m\_typeRptConnection == ModifyConnectionADO) || (m\_typeRptConnection == ModifyConnectionDAO) ) {
    
    		// Ciclo sui parametri del report
    		for( int nIndexParam = 0; nIndexParam < m\_lstParameterConnection.GetItemCount(); nIndexParam++ ) {
    
    			// Nome e Valore parametro
    			bstParameterName = m\_lstParameterConnection.GetItemText(nIndexParam,COL\_0);
    			CString sParameterName(bstParameterName.GetBSTR());
    			if( sParameterName.Compare(ADO\_PARAMETER\_5) != 0 ) {
    
    				// Valore parametro
    				bstParameterValue = m\_lstParameterConnection.GetItemText(nIndexParam,COL\_1);
    
    			}else {
    
    				// Password utente
    				bstParameterValue = GetUserPassword(nIndexParam,COL\_1);
    				
    			}
    
    			// Modifica parametro connessione
    			IConnectionPropertyPtr pConnectionProperty = pNameValuePairs->GetItem(bstParameterName);
    			pConnectionProperty->PutValue(bstParameterValue);
    									
    		}//:End for parametri report
    
    	}else if( (m\_typeRptConnection == ReplaceConnectionADO) || (m\_typeRptConnection == ReplaceConnectionDAO) ) {
    
    		// Cancellazione parametri esistenti
    		pNameValuePairs->DeleteAll();
    
    		// Nome dll da utilizzare
    		\_bstr\_t bstDllName;
    		if( m\_typeRptConnection == ReplaceConnectionADO )
    			bstDllName = DLL\_ADO;
    		else if( m\_typeRptConnection == ReplaceConnectionDAO )
    			bstDllName = DLL\_DAO;
    		m\_pReport->GetDatabase()->GetTables()->GetItem(1)->DllName = bstDllName;
    										
    		// Ciclo sui parametri
    		for( int nIndexParam = 0; nIndexParam < m\_lstParameterConnection.GetItemCount(); nIndexParam++ ) {
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups