Execute .exe in SSRS Report

2020-06-30 02:22发布

问题:

i want to execute a .exe in a SSRS Report from Microsoft Dynamics AX.

I tried so far to realize that over Custom Code and a Textfield with following Expression: =Code.StartProcess("test")

Public Function StartProcess(ByVal s As String) As String  
  Dim pHelp As New ProcessStartInfo
  pHelp.FileName = "test.bat"
  pHelp.Arguments = s
  pHelp.UseShellExecute = True
  pHelp.WindowStyle = ProcessWindowStyle.Normal
  Dim proc As Process = Process.Start(pHelp)
  Return "it works"
End Function 

I get the error ":StartProcess is invalid. InvalidIdentifier"

As second try i use this:

="javascript:void(window.open('file://AX2012R2A/Share/batch.exe'))"

in an action expression.

This trial opened in the report the following message by clicking on the image:

My problem is now that I have to pass a parameter to the batch and then it doesn't work.

Have you any idea to help me?

回答1:

I have solved my Problem.

As first step I mentioned, that also simple methods like:

Public Function StartProcess(ByVal s As String) As String   
  Return "it works"
End Function

brought the error: ":StartProcess is invalid. InvalidIdentifier"

As second step i found this link: Link to Google Group discussion (perhabs you have to expand all messages).

As last step i have to create a Datamethod and then call it in an expression and it works. The code in the datamethod isn't in VB.Net but in C#. How this works, can you see here (Youtube)

Thank you all for your help.