Execute stored procedure in report

半世苍凉 提交于 2020-01-25 07:53:07

问题


My stored procedure and table capture details about which reports are run, by who, and at what time. This works fine in the Crystal Reports developer environment; The sproc gets run and details are captured.

When deployed to Business Objects the insert statements inside my stored procedure don't never fire off. They are definitely in the report, but don't create any entries in the logging table. How can I resolve this?

It's almost like Crystal Reports "scrapes" the SQL out of the stored procedure, ignores insert statements, and runs a query rather than actually running the sproc.

I do not want to use auditing that comes w/ business objects, so how can I get this working instead?


回答1:


you can get the details that you mentioned in the aplication, you don't need to use the db expert just for this info, e.g: In your app

Dim p As New Report
p.ReportName = getReportName()
p.User = getUser()
p.Date = getDate() or "DateTime.Now"
p.show()

in your report:

Public ReportName As String
Public User As String
Public Date As String

"object".SetParameterValue("Parameter Field Name 1", ReportName)
"object".SetParameterValue("Parameter Field Name 2", User)
"object".SetParameterValue("Parameter Field Name 3", Date)

And btw, you can add these data with your proc in your app and not in the report.



来源:https://stackoverflow.com/questions/45717557/execute-stored-procedure-in-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!