cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Parameter Requires Additional Login

Former Member
0 Kudos

I'm working on a WinForms viewer for a MySQL database with VB.Net 2010 and CR2011 (14.0.4.738 RTM and using Engine 13.0.9.1312).

I have recently converted a CR8.5 report from about 8 years ago to CR 2011.  The original was a Union Query and did not work in the current version properly (ignored everything after the UNION ALL), so I converted to a Command.  See here for some more info.  The only difference in that thread is that I had to remove the parameters from the Command because when I edited in the designer to make one a Dynamic parameter, the prompts came up twice when I edited it in the designer level so I removed it from the command to use only the designer level prompt (the number of records does not slow the report down much so I am ok with it this way for now).

It currently works fine in the designer.  All the numbers and formatting is correct.  When I open the program, it asks for a database userid and password, logs onto the database and displays some information on screen from the database.

When I run the report in my viewer, it prompts me for a second userid and password using an Enter Parameter Values screen that shows the Server and Database greyed out, the program name and the field for the dynamic parameter.  I enter the proper userid and password and I get the correct information in my database.  The dialog also includes the Use Single Signon Key  of False that is also greyed out (I don't know how to set this).

I am logging into the database using code to set/change the database, server, userid and password properly.  When I convert the parameter back to a static parameter, it doesn't prompt me for the userid and password when runnign the report, and it does give me the same correct information from the database properly.

Does anyone know what might be causing this extra log in prompt?  I was hoping to add dynamic parameters to more of my reports.

I've done some searching but all the information that comes up so far has been releated to Business Views, I think in the Business Objects program itself and one solution is to enter a database userid and password associated with the Business View.  Because I am only using Crystal directly with a MySQL database, I can't use that solution.

Any help is greatly appreciated, TIA rasinc.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Rasinc,

The double DB prompt is because Dynamic parameters is a separate query to the DB to build the value list.

It's odd that that, I assume connection info, is the same as the Report Designer data source.

Likely what is happening is because your Command requires a log and then your Parameter in R Designer also needs to log on is why you are being prompted 2 times.

You should be able to set the log on info in code then it should not prompt at all. Or change the Connection to use Trusted authentication, need to do this in the Report first.

The connection info is grayed out because CR will only allow the original connection to be used.

Don

Former Member
0 Kudos

Hi Don,

Thanks for the reply and sorry these posts are so long.  I've just done a quick test and created two reports in CR2011.   Each report is run off the same customer table and the optional dynamic parameter is based on the customer name field.

The first runs off the customer table by referencing the table, though only one table so no linking is necessary.

The second runs off a command that pulls the same fields.

In both cases, when I run it through my viewer program the same dialog asks for userid and password at the time of running the report, just before the prompt comes up.  When I switch both back to static parameters, neither ask for the userid and password when running the report.

So it does look like the dynamic parameter is causing the second login, not the fact that I am using a command in this particular report as I thought might be the case.

In both cases the data source is an ODBC data source that I create on the computer through code.  Also, the reports are run on the same User DSN as it is designed on, though my code will change it if necessary.  I did the test this way to eliminate possible complexity.

My code does change the table login parameters properly, in both main and subreports.  Many other reports work fine and when I switch databases, the new data with the same reports work well.


So how do I change the login parameters for the dynamic parameter query?  I can't find any specs on it through code.  I can use the ParameterFieldDefinition and go through each parameter in ParameterFieldDefinitions, find it's name, the PromptText, if it is optional, etc. but I cannot see where to change the login parameters for the query (see code below).  In fact, I cannot see the query itself.  How do I locate all this through code?

I am afraid, I don't know anything about Trusted Authentication except that I have seen it in reference to SQL Server, but I'm using MySQL, so I don't know if it applies in this case.  And if I recall what it means, the Windows login is used with accessing the database and in this case, that is not the happening.  Users have different userids than Windows (I have no control over this).


Dim crParamFieldDefs As ParameterFieldDefinitions
Dim crParamFieldDef As ParameterFieldDefinition

Dim x As Integer = crViewer.ParameterFieldInfo.Count


crParamFieldDefs = crReport.DataDefinition.ParameterFields


      For Each crParamFieldDef In crParamFieldDefs
                  MessageBox.Show(crParamFieldDef.ParameterFieldName)
      Next

Thank you again for the help, rasinc.

former_member183750
Active Contributor
0 Kudos

Hi Rasinc

In one of the early builds of CR 2008 we had a similar issue that was tracked and fixed. As far as I know the fix was propagated fort all subsequent CR versions. However, I don't think I've seen the combination of command / table, so perhaps there is something going on there. Anyhow. Back to the issue with CR 2008. At the time, I created a KBA that provided a work-around to the issue until the fix was released. I'd like you to take a look at the KBA, see if you can test the work-around(?). Here is the KBA:

1412611 - Crystal Reports 2008 using Dynamic parameters, prompts for database logon when used In Vis...

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter


Former Member
0 Kudos

Thanks Ludek,

I'll take a look at the article.  Just to clarify, I am not using a command and table in the same report.  I was just testing to see if the login prompt was caused by the command not getting the proper login credentials from my code, so I was testing essentially the same SQL code by using a command in one report and a table in the other.

Former Member
0 Kudos

Ludek,

Ok, the basic code I am using is essentially the same as in your article.  The only change I made was adding the crReportDocument.Refresh() command and the crReportDocument.DataSourceConnections(0).... line.

Unfortunately, it did not change anything.  I did confirm it is getting the correct values for the connection info.

I tried to adjust the value of the parameter by picking another customer from the Parameter Panel and it asked for the login userid and password again, each time I want to change the customer.

Answers (0)