2013-04-18 1 views
0

Ceci est mon recueil HSC lignes de données de base de données ne sont pas affichées dans le rapport de rdlc

protected void btnCreateBill_Click(object sender, EventArgs e) 
{ 
    DisplayReport(); 

} 
private DataTable TotalInfoData() 
{ 
    try 
    { 
     // Open Sql Connection 
     SqlConnection SqlCon = new SqlConnection(@"Data Source=PRATIKPC;Initial Catalog=dbbilling2.0;Integrated Security=True"); 
     SqlCon.Open(); 

     // Create a Command 
     SqlCommand SqlComm = new SqlCommand(); 
     SqlComm.Connection = SqlCon; 
     SqlComm.CommandType = CommandType.Text; 
     SqlComm.CommandText = "select * from tblTotalFee where Class='" + ClassDropDownList.SelectedItem.Value + "'and StudentID='" + StudentNameDropDownList.SelectedItem.Value+"'"; 

     // Create instance of Northwind DataSetXSD 
     DataSet1.tblTotalFeeDataTable TotalInfoData = new DataSet1.tblTotalFeeDataTable(); 

     // Set a Data Commands 
     SqlDataAdapter SqlDa = new SqlDataAdapter(SqlComm); 
     SqlDa.Fill(TotalInfoData); // Fill Data in NorthwindDataSet Object. 

     return TotalInfoData; 

    } 

    catch (Exception ex) 
    { 
     throw new Exception(ex.Message); 
    } 
} 
private void DisplayReport() 
{ 
    try 
    { 
     // Clear the Data Source 
     ReportingForPrintingReportViewer.LocalReport.DataSources.Clear(); 

     // Set a DataSource to the report 

     // First Parameter - Report DataSet Name 
     // Second Parameter - DataSource Object i.e DataTable 
     ReportingForPrintingReportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", TotalInfoData())); 

     // OR Set Report Path 
     ReportingForPrintingReportViewer.LocalReport.ReportPath = HttpContext.Current.Server.MapPath("~/Report.rdlc"); 

     // Refresh and Display Report 
     ReportingForPrintingReportViewer.LocalReport.Refresh(); 
    } 
    catch (Exception ex) 
    { 
     throw new Exception(ex.Message); 
    } 
} 

Pourquoi aucune sortie à venir dans le rapport ?? Il y a des lignes dans ma base de données mais elles n'ont pas été retournées. Mon rapport ressemble à ceci après l'opération. Pourquoi les lignes ne sont-elles pas affichées? enter image description here

Ceci est mon jeu de données enter image description here

+0

Y a-t-il une exception? – TechDo

+0

@techdo Non il n'y a pas d'exception –

Répondre

0

Essayez d'ajouter le nom du schéma avant le nom du jeu de données. J'aime- SchemaName_DataSet1.

ReportingForPrintingReportViewer.LocalReport.DataSources.Add(new ReportDataSource("SchemaName_DataSet1", TotalInfoData())); 
+0

comment puis-je obtenir le nom de schéma d'un ensemble de données ?? –

Questions connexes