Hi jlo,
Some options:
EXTERNAL REPORTS (as per your example
1) Parameterised report with Stored procedure
Ideally you would have a stored procedure in the database that takes the
'range' parameters.
The report would then be altered to have the sproc as its datasource and it
would provide the parameters
2) Parameterised report straight from table
You can alter the report to have the range parameters and have it limit the
table data displayed (Not as efficient.)
INTERNAL REPORT
(Disadvantage of internal report is new installation needed if report
changes.)
Assumes a datalayer in your application.
Make a typed dataset and fill it.
Design a internal report that takes the typed dataset as its datasource.
Hang that in the Report viewer
The visual studio crystal engine has all the necessary classes to allow you
to manipulate the report before you hang it in the viewer.
Some c# code dealing with a parameterised external report and some vb
dealing with an internal report follows
hth
bob
/// <summary>
/// CrystalReportsP arameters is a dll based on Bill Sergio's article
///
http://www.codeproject.com/useritems/crystalWin.asp
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cmdView_Click(o bject sender, EventArgs e)
{
if (dgReports.Sele ctedRows.Count == 0) //Reports are listed in a grid
{
MessageBox.Show (rm.GetString(" String133")); //pick a report
return;
}
this.Cursor = Cursors.WaitCur sor;
CrystalDecision s.Shared.TableL ogOnInfo t; //logging on to database
t = new CrystalDecision s.Shared.TableL ogOnInfo();
t.ConnectionInf o.DatabaseName = mLogger.RegGetS tringValue("MyA pp",
"Database", "Server");
t.ConnectionInf o.UserID = "myuser";
t.ConnectionInf o.Password = "mypassword ";
string sReportFile = mstrReportPath +
dgReports.Selec tedRows[0].Cells[1].Value.ToString ();
string sReport = dgReports.Selec tedRows[0].Cells[1].Value.ToString ();
ReportDocument r;
CrystalReportPa rameters.ICryst alParameters c = new
CrystalReportPa rameters.clsMai n() ; // Pretty parameter screen courtesy of
Bill Sergio, otherwise use parameterfields collection of ReportDocument
r = c.DisplayParame ters(sReport, sReportFile);//Displays parameters , takes
values returns ReportDoc
if(r!=null)
{
crv.LogOnInfo = new CrystalDecision s.Shared.TableL ogOnInfos();//crv is the
Crystal Reports Viewer on the form
crv.LogOnInfo.A dd(t);
crv.ReportSourc e = r;
}
else
{
MessageBox.Show (rm.GetString(" String77"));
}
this.Cursor=Cur sors.Default;
return;
**********Inter nal report *********
Private Sub loadReportLease dMeter(ByRef ds As dsMeterCost)
Try
Dim rd As New ReportMeterInvo ice
rd.SetDataSourc e(ds)
Me.crvMain.Repo rtSource = rd
Catch ex As Exception
WriteErrorLog(" frmReport.loadR eportReprogram " & ex.Message)
End Try
End Sub
*************** *************** *********
"Jlo" <lo*******@gmai l.comwrote in message
news:uk******** ******@TK2MSFTN GP05.phx.gbl...
Hi, I have a c# winforms application.
When I call the report file, it shows me all the records in the table.
How can I make it to call only a particular range.
i have the following code
Viewer1.ReportS ource = Application.Sta rtupPath + "//Label.rpt";
How can I assign it a dataset which have the data of a particular range.
Gurus, I hope I am clear.
Need it urgently, as my client is waiting for this for a long time.
thanks
-jlo