Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password Problem

Status
Not open for further replies.

Saint1234

Programmer
Feb 18, 2004
25
IE
Hi All,
I am using crystal with visual studio 2003. The problem I am having is :
I have a datagrid in c#, I am passing this to crystal, no problems worked fine. I then added a subreport which used a SQL Command, as soon as this went in crystal started prompting for server name, database name, u/name and p/w. I have had this problem before and I used this code

crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "servername"; //physical server name
crConnectionInfo.DatabaseName = "dbname";
crConnectionInfo.UserID = "id";
crConnectionInfo.Password = "pw";

//Define and set the logon information for the table
crTableLogOnInfo = new TableLogOnInfo();
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTableLogOnInfo.TableName = "Command";

//Pass the table info to a collection of tables
crTableLogOnInfos = new TableLogOnInfos();
crTableLogOnInfos.Add(crTableLogOnInfo);

//Pass the entire collection of table logon information to the viewer
crystalReportViewer1.LogOnInfo = crTableLogOnInfos;

//Set the viewer to the report object to be previewed
//This must be done after all the database logon has been set
crystalReportViewer1.ReportSource = crReportDocument;

This code has been used before and works fine, although i have never used it when passing a dataset.

I was wondering if anyone has come across the same problem

Thanks in advance
G
 
Try opening the main report in "Design Mode", right click on the sub-report and click on "Create Sub-Report Links". You will then be able to set this up to pass any/all parameters from the main report to the sub-report without getting prompted to do so.

~Gene

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top