Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3276

How to use Powershell with Crystal Decisions

$
0
0

Hi,

i would like to use Powershell with Crystal Decisions for exporting crystal reports. Unfortunately i have a problem.
If i save my report without saved data to force an update of the report with new parameters i get the following error:

 

error.jpg

 

 

I guess its something about connecting to the sybase database because when i run my script with a report with saved data it works.

 

Does anybody know this behaviour?

Thank you!!

 

CRRuntime_64bit_13_0_12

Crystal Reports 2008

 

My code:

 

Param(

 

  [string]$FirstName1

 

)

 

 

 

[reflection.assembly]::LoadWithPartialName('CrystalDecisions.Shared')

[reflection.assembly]::LoadWithPartialName('CrystalDecisions.CrystalReports.Engine')

 

 

 

$report = New-Object CrystalDecisions.CrystalReports.Engine.ReportDocument

 

 

$report.Load("C:\Users\geservice\Desktop\shell\Textbefund.rpt")

 

 

 


foreach ($Table in $report.Database.Tables)           

    {           

        $table           

        $tli = $Table.LogonInfo           

        $li = $tli.ConnectionInfo           

        Write-host "location : $($table.location)"          

        $li.ServerName = "myserver"           

        $li.DatabaseName = "mydb"            

        $li.UserID = "user"           

        $li.Password = "password"  

        $Table.ApplyLogOnInfo($tli)           

            

        $table.location            

                  

    }  

 

 

 

 

 

$report.SetParameterValue("FirstName",$FirstName1)

 

 

 

$report.ExportToDisk("Text","C:\Users\geservice\Desktop\shell\Textbefund.txt")

 

 

$report.close()


Viewing all articles
Browse latest Browse all 3276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>