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
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