Click here to Skip to main content
15,917,971 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to pass my list object to a data set and then view data in crystal report.I have written following code but its not seems to be working, data is not appearing in the report. and it says "The report you requested requires further information."

pls help me to solve this issue , thanx


protected void ButtonView_Click(object sender, EventArgs e)
{
SongsExtraBD sngexbd = new SongsExtraBD();
List<tblsongs> objSongList = new List<tblsongs>();
objSongList = sngexbd.GetDownLoadList();

dsTest mydsTest = new dsTest();
DataTable objDataTable = new DataTable("tblSongs");

objDataTable.Columns.Add("SongID");
objDataTable.Columns.Add("Name");
objDataTable.Columns.Add("Rate");
objDataTable.Columns.Add("Language");

DataRow myDataRow;
foreach (tblSong tblsng in objSongList)
{

myDataRow = objDataTable.NewRow();
myDataRow[0] = tblsng.SongID;
myDataRow[1] = tblsng.Name;
myDataRow[2] = tblsng.tblrates.Rate;
myDataRow[3] = tblsng.Language;

objDataTable.Rows.Add(myDataRow);

}

mydsTest.Tables.Add(objDataTable);
rptDownLoad report = new rptDownLoad();
report.SetDataSource(mydsTest);
crptViewer.ReportSource = report;


}
Posted

1 solution

Hi man,

Pass Datatable instead of Dataset to report object

Example,

report.SetDataSource(dataTable);

or

report.SetDataSource(dataset.tables[0]);

then i'm sure it needs login information

report.SetDatabaseLogon(DBUserID, DBPwd);


let me know if still trouble

Regards,
thatraja
 
Share this answer
 

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