Quantcast
Channel: SCN: Message List - Dynamic Parameter Logon Prompt with .NET SDK
Viewing all articles
Browse latest Browse all 6

Dynamic Parameter Logon Prompt with .NET SDK

$
0
0

I'm at a loss as to how to solve this problem with a .NET solution that employs a SQL Command as the Crystal Report data source and has a dynamic parameter. The CrystalReports.Engine.ReportDocument is manipulated using C# code, providing the LogonProperties for each of the tables/commands in the report. However, it appears that it is not possible to set the ReportDocument.DataSourceConnections.LogonProperties at runtime.

 

I have tried the following code to achieve this:


foreach (InternalConnectionInfo internalConnectionInfo in Report.DataSourceConnections)

{

internalConnectionInfo.SetConnection("Server", "DBName", UserId, Password);

internalConnectionInfo.SetLogon(UserId, Password);

internalConnectionInfo.LogonProperties.Add(new NameValuePair2("UserID", UserId));

internalConnectionInfo.LogonProperties.Add(new NameValuePair2("Password", Password));

internalConnectionInfo.LogonProperties.Set("UserID", UserId);

internalConnectionInfo.LogonProperties.Set("Password", Password);

}

 

When I inspect Report.DataSourceConnections.Password value after running this code the Password is empty string(""). As implied by the object name it appears to be an INTERNAL object and although all these methods above are effective when inspecting the internalConnectionInfo object, these aren't set in the "parent" object, as mentioned.

 

1) Is it possible to set the Report.DataSourceConnections.Password value by code?


2) Where/how in code, can I pass the dynamic parameter the logon properties it needs so the user doesn't get prompted for them at runtime in a C# solution?

 


David Paynter


Viewing all articles
Browse latest Browse all 6

Trending Articles



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