LO HE LOGRADO
PARA QUIEN LE INTERESE......
........
........
ReportDocument rd = new ReportDocument();
//PARA ESTE CASO SOLO TENGO 2 PARAMETROS EN MI ARRAYLlIST
this.MyParameterValues.Add(parametro1);
this.MyParameterValues.Add(parametro2);
rd.Load("C://FormR.rpt");
SetReportParameters(rd);
crConnectionInfo.ServerName = "myServer";
crConnectionInfo.DatabaseName = "myBD";
crConnectionInfo.UserID = "myUser";
crConnectionInfo.Password = "myPassword";
crDatabase = rd.Database;
crTables = crDatabase.Tables;
foreach(CrystalDecisions.CrystalReports.Engine.Tab le crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
this.CrystalReportViewer1.ReportSource = rd;
...........
...........
...........
// METODO
private CrystalDecisions.CrystalReports.Engine.ParameterFi eldDefinition SetReportParameters(CrystalDecisions.CrystalReport s.Engine.ReportDocument MyReport)
{
//sets the parameter values for main report and sub reports if any
CrystalDecisions.CrystalReports.Engine.ParameterFi eldDefinition ParameterFieldDefinition;
CrystalDecisions.Shared.ParameterDiscreteValue ParameterDiscreteValue;
CrystalDecisions.Shared.ParameterValues ParameterValues;
int paramcount;
paramcount = this.MyParameterValues.Count;
ParameterFieldDefinition = null;
for (int i = 0; i < paramcount; i++)//have to put paramcount otherwise hard code it .works
{
ParameterFieldDefinition = MyReport.DataDefinition.ParameterFields[i];
ParameterValues = new CrystalDecisions.Shared.ParameterValues();
ParameterDiscreteValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
ParameterDiscreteValue.Value = this.MyParameterValues[i];
ParameterValues.Add(ParameterDiscreteValue);
ParameterFieldDefinition.CurrentValues.Clear();
ParameterFieldDefinition.DefaultValues.Clear();
ParameterFieldDefinition.ApplyCurrentValues(Parame terValues);
}
return ParameterFieldDefinition;
}