<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: login required for dynamic parameter with a command d... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14155253#M4920276</link>
    <description>&lt;P&gt;OK, this post isn't an answer.&amp;nbsp; It's to give a more detailed reply to Don's answer above since I can't see how to do that outside of submitting an answer!&lt;/P&gt;&lt;P&gt;So following Don's suggestions and downloading and studying the&amp;nbsp;RAS2010_CsharpParameters from the article he linked. I was able to make the parameters popup screen go away.&amp;nbsp; SO in the demo app, my using SetParam and then Replace Conn, it made the parameter popup go away.&amp;nbsp; 'Cool', I thought.&amp;nbsp; As per that app, I set our missing parameter to empty string and then it applied our existing connection code and we got the same results.&amp;nbsp; Yay!&amp;nbsp; Only, it then occurred to me this isn't quite what I want!&lt;/P&gt;&lt;P&gt;I want the parameter popup. I just don't want the logon details on it.&amp;nbsp; So I want the command to logon to SQL server, retrieve the data, present the results to the user in a combo box as the source for a dynamic parameter prompt.&amp;nbsp; But if I've set the parameter to empty string, we don't get any prompt - because the parameter is already set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So attached are screen show of it working this way in the v11 COM based viewer.&amp;nbsp; Whereas the screenshot called logon in the original post shows how the parameters popup looks in 13 dot net viewer.&amp;nbsp; But if i set the parameter in code, it does avoid the login prompt. But it also doesn't bring up the prompt I do want. Because we set it in code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this make sense?&amp;nbsp; Is this possible in 13?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jul 2025 12:55:04 GMT</pubDate>
    <dc:creator>mark_brill91</dc:creator>
    <dc:date>2025-07-17T12:55:04Z</dc:date>
    <item>
      <title>login required for dynamic parameter with a command data source</title>
      <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaq-p/13595123</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We have a dot net application for viewing crystal reports which ships with our software to display both pre-supplied reports and end users custom reports.&amp;nbsp; It uses Table.ApplyLogOnInfo to point to an end users SQL server and database and set a SQL user and pass for each table in the report and all sub reports.&lt;/P&gt;&lt;P&gt;One of our end users has created a report with a dynamic parameter based on a command and this causes Crystal to display a login screen that reads:&lt;/P&gt;&lt;P&gt;Enter Parameter values: Server name (disabled), User Name, Password, Use Single Signon Key (set to false and disabled)&lt;/P&gt;&lt;P&gt;If we enter the SQL username and password - the report then works fine, displaying the list of values from the DB.&amp;nbsp; I've tried this in Crystal 13 SP33 and SP35, 32 bit in a viewer compiled in VS2019&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do we avoid this login screen?&amp;nbsp; Stepping through the code in debug, ApplyLogOnInfo is being applied to the command and TestConnectivity returns true.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This can be recreated with a pretty simple report:&lt;/P&gt;&lt;P&gt;Using a system DSN to SQL Server using SQL Server auth&lt;/P&gt;&lt;P&gt;I create a simple command of the form: 'select field from table'&lt;/P&gt;&lt;P&gt;I then create a new dynamic parameter and set the field in this command as the datasource&lt;/P&gt;&lt;P&gt;I then drop this parameter on to the report&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When this report is sent to our viewer it then loops through all tables on the report (and all tables in any sub reports - not relevant in this example)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each table:&lt;/P&gt;&lt;P&gt;foreach (Table tbl in rep.Database.Tables)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we clone the logoninfo, modify it as desired and apply it:&lt;/P&gt;&lt;P&gt;TableLogOnInfo info = (TableLogOnInfo)tbl.LogOnInfo.Clone();&lt;BR /&gt;info.ConnectionInfo = CrystalSupport.GetConnectionInfo(ServerName, database, UserID, Password, Provider);&lt;BR /&gt;tbl.ApplyLogOnInfo(info);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We then test it&amp;nbsp;and it comes back fine:&lt;/P&gt;&lt;P&gt;if (tbl.TestConnectivity())&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The routine to configure the connectionInfo is as follows (this was written long ago, not by me, and I don't necessarily know what all these properties are! I would imagine a lot of it came from an example?):&lt;/P&gt;&lt;P&gt;private static ConnectionInfo GetConnectionInfo(string serverName, string databaseName, string userId, string password, string provider)&lt;BR /&gt;{&lt;BR /&gt;ConnectionInfo connectionInfo = new ConnectionInfo();&lt;BR /&gt;connectionInfo.Type = ConnectionInfoType.SQL;&lt;BR /&gt;connectionInfo.ServerName = serverName;&lt;BR /&gt;connectionInfo.DatabaseName = databaseName;&lt;BR /&gt;connectionInfo.UserID = userId;&lt;BR /&gt;connectionInfo.Password = password;&lt;/P&gt;&lt;P&gt;CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag connectionAttributes = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();&lt;BR /&gt;connectionAttributes.EnsureCapacity(11);&lt;BR /&gt;connectionAttributes.Add("Connect Timeout", "15");&lt;BR /&gt;connectionAttributes.Add("Data Source", connectionInfo.ServerName);&lt;BR /&gt;connectionAttributes.Add("General Timeout", "0");&lt;BR /&gt;connectionAttributes.Add("Initial Catalog", connectionInfo.DatabaseName);&lt;BR /&gt;connectionAttributes.Add("Integrated Security", "false");&lt;BR /&gt;connectionAttributes.Add("Locale Identifier", "1033");&lt;BR /&gt;connectionAttributes.Add("OLE DB Services", "-5");&lt;BR /&gt;connectionAttributes.Add("Provider", provider);&lt;BR /&gt;connectionAttributes.Add("Tag with column collation when possible", "0");&lt;BR /&gt;connectionAttributes.Add("Use DSN Default Properties", false);&lt;BR /&gt;connectionAttributes.Add("Use Encryption for Data", "0");&lt;/P&gt;&lt;P&gt;DbConnectionAttributes attributes = new DbConnectionAttributes();&lt;BR /&gt;attributes.Collection.Add(new NameValuePair2("Database DLL", "crdb_ado.dll"));&lt;BR /&gt;attributes.Collection.Add(new NameValuePair2("QE_DatabaseName", connectionInfo.DatabaseName));&lt;BR /&gt;attributes.Collection.Add(new NameValuePair2("QE_DatabaseType", "OLE DB (ADO)"));&lt;BR /&gt;attributes.Collection.Add(new NameValuePair2("QE_LogonProperties", connectionAttributes));&lt;BR /&gt;attributes.Collection.Add(new NameValuePair2("QE_ServerDescription", connectionInfo.ServerName));&lt;BR /&gt;attributes.Collection.Add(new NameValuePair2("SSO Enabled", "false"));&lt;/P&gt;&lt;P&gt;connectionInfo.Attributes = attributes;&lt;/P&gt;&lt;P&gt;return connectionInfo;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So... this process has worked for years on tables.&amp;nbsp; And successfully applies and tests on commands.&amp;nbsp; But when a dynamic parameter uses this command as a data source - it prompts for a log in.&amp;nbsp; Does anyone have any ideas what I can do to get this logged in via code?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 14:52:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaq-p/13595123</guid>
      <dc:creator>mark_brill91</dc:creator>
      <dc:date>2024-02-05T14:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: login required for dynamic parameter with a command d...</title>
      <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/13601791#M4817679</link>
      <description>&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;Commands are considered Stored Procedures requiring the parameter value be set before logging in, because the SP needs a value to be able to process it.&lt;/P&gt;&lt;P&gt;In your app you can use the below code to see if the report is using a Command and if so set the Parameter first and then set the log on info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
    if (crDatabase.Tables.Count != 0)
    {
        CrystalDecisions.Shared.NameValuePair2 nvp2 = (NameValuePair2)rpt.Database.Tables[dbx].LogOnInfo.ConnectionInfo.Attributes.Collection[1];
        btnSQLStatement.Text += "\nRPT Data Source Info: \n" + " Server Name: " + rpt.Database.Tables[dbx].LogOnInfo.ConnectionInfo.ServerName.ToString() + "\n Database Name: " + nvp2.Value.ToString() + "\n Table Name: " + rpt.Database.Tables[dbx].Name.ToString();
        if (rpt.Database.Tables[dbx].LogOnInfo.ConnectionInfo.UserID != null)
            btnSQLStatement.Text += "\n User ID: " + rpt.Database.Tables[dbx].LogOnInfo.ConnectionInfo.UserID.ToString() + "\r\n";
        btrSearchPath.Text = rpt.Database.Tables[dbx].Name.ToString();
        dbx++;
    }
    else
        btnSQLStatement.Text += "No Data source or not found\r\n";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Or this way to scan the parameters:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;if (paramfield.ParameterType.ToString() == "crParameterFieldTypeStoredProcedureParameter")
{
    if (IsCMD)
        btnReportObjects.AppendText(" (Command)");
    else
        if (IsBEX == false)
        btnReportObjects.AppendText(" (Stored Procedure)");
    else
        btnReportObjects.AppendText(" (BEX Query)");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other thing to note is since the Server name is blank it could indicate the report is using a different set of Connection info and it failed to connect.&lt;/P&gt;&lt;P&gt;You'll have to do some more report debugging, make sure it matches your connection info.&lt;/P&gt;&lt;P&gt;The Parameter sample app I wrote has more details:&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2016/02/17/how-to-parameters-in-crystal-reports-for-visual-studio-net/" target="_blank" rel="noopener noreferrer"&gt;&lt;STRONG&gt;how-to-parameters-in-crystal-reports-for-visual-studio-net&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Don&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2024 21:04:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/13601791#M4817679</guid>
      <dc:creator>DonWilliams</dc:creator>
      <dc:date>2024-02-11T21:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: login required for dynamic parameter with a command d...</title>
      <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/13602081#M4817736</link>
      <description>&lt;P&gt;Hi Don,&lt;/P&gt;&lt;P&gt;thanks for this information.&amp;nbsp; This looks great and your response is much appreciated!&amp;nbsp; I'll have a go through this later in the week and let you know how I get on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 08:15:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/13602081#M4817736</guid>
      <dc:creator>mark_brill91</dc:creator>
      <dc:date>2024-02-12T08:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: login required for dynamic parameter with a command d...</title>
      <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/13620500#M4819919</link>
      <description>I got dragged onto something else unfortunately so I've not had chance to look at this again yet but I do appreciate the time you put in your response and I will have a go at this again when I'm able. Thanks once again!</description>
      <pubDate>Tue, 27 Feb 2024 09:47:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/13620500#M4819919</guid>
      <dc:creator>mark_brill91</dc:creator>
      <dc:date>2024-02-27T09:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: login required for dynamic parameter with a command d...</title>
      <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14155208#M4920272</link>
      <description>OK, it's been a long time but I finally got a chance to play with this again. I can see why you suggested what you did and it was helpful to my understanding but it doesn't quite solve the issue in the way I need. I can only see how to get to a full editor via the answer box. So I'm going to clarify my problem via an answer!</description>
      <pubDate>Thu, 17 Jul 2025 12:17:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14155208#M4920272</guid>
      <dc:creator>mark_brill91</dc:creator>
      <dc:date>2025-07-17T12:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: login required for dynamic parameter with a command d...</title>
      <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14155253#M4920276</link>
      <description>&lt;P&gt;OK, this post isn't an answer.&amp;nbsp; It's to give a more detailed reply to Don's answer above since I can't see how to do that outside of submitting an answer!&lt;/P&gt;&lt;P&gt;So following Don's suggestions and downloading and studying the&amp;nbsp;RAS2010_CsharpParameters from the article he linked. I was able to make the parameters popup screen go away.&amp;nbsp; SO in the demo app, my using SetParam and then Replace Conn, it made the parameter popup go away.&amp;nbsp; 'Cool', I thought.&amp;nbsp; As per that app, I set our missing parameter to empty string and then it applied our existing connection code and we got the same results.&amp;nbsp; Yay!&amp;nbsp; Only, it then occurred to me this isn't quite what I want!&lt;/P&gt;&lt;P&gt;I want the parameter popup. I just don't want the logon details on it.&amp;nbsp; So I want the command to logon to SQL server, retrieve the data, present the results to the user in a combo box as the source for a dynamic parameter prompt.&amp;nbsp; But if I've set the parameter to empty string, we don't get any prompt - because the parameter is already set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So attached are screen show of it working this way in the v11 COM based viewer.&amp;nbsp; Whereas the screenshot called logon in the original post shows how the parameters popup looks in 13 dot net viewer.&amp;nbsp; But if i set the parameter in code, it does avoid the login prompt. But it also doesn't bring up the prompt I do want. Because we set it in code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this make sense?&amp;nbsp; Is this possible in 13?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 12:55:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14155253#M4920276</guid>
      <dc:creator>mark_brill91</dc:creator>
      <dc:date>2025-07-17T12:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: login required for dynamic parameter with a command d...</title>
      <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14155319#M4920290</link>
      <description>&lt;P&gt;Hi Mark, See if this helps, change the default value. It's a property of the viewer, you can set it in code also:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;crystalReportViewer1.ReuseParameterValuesOnRefresh = false; // or True&lt;/LI-CODE&gt;&lt;P&gt;Try adding a Report.refresh also, you may need to test this in various places, because it can discard any values you may have previously set.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DonWilliams_0-1752760597072.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/287948i4CBC9A1CAC329D7F/image-size/medium?v=v2&amp;amp;px=400" alt="DonWilliams_0-1752760597072.png" title="DonWilliams_0-1752760597072.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 14:02:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14155319#M4920290</guid>
      <dc:creator>DonWilliams</dc:creator>
      <dc:date>2025-07-17T14:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: login required for dynamic parameter with a command d...</title>
      <link>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14158718#M4920611</link>
      <description>Success! Setting a default parameter, then the DB connection, showing it, then a refresh works in your example app! I'm sure I can work something from this into our app now. Thanks for all your help!</description>
      <pubDate>Tue, 22 Jul 2025 07:16:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/login-required-for-dynamic-parameter-with-a-command-data-source/qaa-p/14158718#M4920611</guid>
      <dc:creator>mark_brill91</dc:creator>
      <dc:date>2025-07-22T07:16:44Z</dc:date>
    </item>
  </channel>
</rss>

