Alben Labajo

Alben Labajo

  • NA
  • 1
  • 905

How to export reportviewer using Dtatableadapter.fill()

Sep 16 2014 11:31 PM
 I have here the working code: 
 
this.tblpricereportTableAdapter.Fill(this.cipDataSet.tblpricereport, NxtPlayerIdNo, int.Parse(terminal));
reportViewer1.RefreshReport();
 
But i cannot used that reportViewer1. Here:
 
 
private void Export(LocalReport report)
{
string deviceInfo =
@"<DeviceInfo>
<OutputFormat>EMF</OutputFormat>
<PageWidth>4in</PageWidth>
<PageHeight>11in</PageHeight>
<MarginTop>0in</MarginTop>
<MarginLeft>0.5in</MarginLeft>
<MarginRight>0.5in</MarginRight>
<MarginBottom>0.5in</MarginBottom>
</DeviceInfo>";
Warning[] warnings;
m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream, out warnings);
foreach (Stream stream in m_streams)
stream.Position = 0;
}
 
So i tried the following  in order for me to automatically print the result of my report viewer but its not working same as the working code.

CIP.CLASSES.Connection _conn = new CLASSES.Connection();
strSQL = "SELECT fldPriceName, fldPricePerUnit FROM tblpricereport WHERE fldPlayerIDNo='" + NxtPlayerIdNo + "' AND fldTerminalNo='" + int.Parse(terminal) + "' ORDER BY fldPriceName ASC";
lvwLocReader = _conn.DisplayDataGridView(strSQL, "tblpricereport");
lvwLocReader.Fill(cipdataset, "tblpricereport");
LocalReport report = new LocalReport();
report.ReportPath = "D:/Report.rdlc";
report.DataSources.Clear();
report.DataSources.Add(new ReportDataSource("DataSet1", cipdataset.Tables["tblpricereport"]));
 
Export(report);
Print();
 
THE SCENARIO IS THIS:
1. The result from first encounter i entered 1 the result is 1.
2. then the second i entered one but the result is 2.
3. third is i entered 1 the result is 3.
3. and so on.... 
 
Now, my problem is how to get the same value of my working reportviewer1 which is
 
this.tblpricereportTableAdapter.Fill(this.cipDataSet.tblpricereport, NxtPlayerIdNo, int.Parse(terminal));
reportViewer1.RefreshReport();
 
to be used for rendering.
 
I need your help. I am new here. I  am also new working report viewer also. so please help me.