Crystal Reports: displaying data from an SQL DataTable in C#

Crystal Reports: displaying data from an SQL DataTable in C#

Post by Mark Chime » Fri, 09 Mar 2007 14:15:31


Hi JT,

Here is some code that will help you.
What you have done is try and connect your datasource to the Crystal Report
DatatSource.
What you actually need to do is pass your datasource to the Crystal Report
sand let it connect "internally".

System.Configuration.AppSettingsReader configurationAppSettings
= new System.Configuration.AppSettingsReader();
//string strServerName =
((string)(configurationAppSettings.GetValue("ServerName", typeof(string))));
//"SERVER2003/SQLEXPRESS"; //physical server name
// if (strReport == "Team")
{
DataSourceConnections dataSourceConnections =
crReportDocument.DataSourceConnections;
IConnectionInfo connectInfo = dataSourceConnections[0];
//connectInfo.SetConnection(strServerName, "WORKman",
"SQLUSerID", "password");
crViewer.ReportSource = crReportDocument;
if (strFormula != string.Empty)
crReportDocument.DataDefinition.RecordSelectionFormula =
strFormula;
}


cheers,
Mark Chimes




--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 1865 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
 
 
 

Crystal Reports: displaying data from an SQL DataTable in C#

Post by Pedro Ruiz » Sun, 06 May 2007 05:54:12

Hola Mark, yo tengo el mismo problema de JT, la diferencia es que el mio
estcreado en VS.NRET 2005...

Agradecer cualquier comentario..

Saludos

Pedro
Peru

"Mark Chimes"<< XXXX@XXXXX.COM >> escribien el mensaje