Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends

Please tell me why do not appear the attribute called Item in my
c# code:

I show the following image to illustrate:





but I need that code line must appear like:

rpt2.Subreports.Item("SubReport2").SetDataSource(detaDs.Tables["tarjeta1"])



Please tell me what it's wrong. i need the Item attibute to
add subreports in my c# aplication.

Thanks in advance!
Posted

1 solution

Because your code should be written as:
rpt2.Subreports("SubReport2").SetDataSource...
 
Share this answer
 
Comments
leocode7 24-Jan-11 11:41am    
hello friend, thaks, please hel me once!
I can use this sentnce in a for cicle ???

like:
for (int i = 0; i < detaDs.Tables[0].Rows.Count; i++)
{
DataSet detaDs2 = new DataSet();
linea = detaDs.Tables[0].Rows[i]["cod_lin"].ToString();

//SQL QUERY--------------------
sql2 = "select vuelta,linea.linea,salida,vsalida as ver,R1 as Reloj1,M1 as Marca1,AT1,AD1,R2 as Reloj2,M2 as Marca2,AT2,AD2,R3 as Reloj3,M3 as Marca3,AT3,AD3,R4 as Reloj4,M4 as Marca4,AT4,AD4,R5 as Reloj5,M5 as Marca5,AT5,AD5 from deta_tarjeta,linea where deta_tarjeta.cod_tar='" + code_tar + "' and deta_tarjeta.cod_lin='" + linea + "' and deta_tarjeta.cod_lin=linea.cod order by vuelta asc";
//END SQL QUERY-----------------

detaDs2 = con.consulta(sql2);
detaDs2.Tables[0].TableName = "tarjeta"+(i+1);
rpt2.Subreports["subreport"+(i+1)].SetDataSource(detaDs2.Tables["tarjeta"+(i+1)]); // I can do this?????
detaDs2.Dispose();

} //END FOR

this.crystalReportViewer1.ReportSource = rpt2;
this.crystalReportViewer1.Refresh();

detaDs.Dispose();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900