Crystal Reports, SQl 2000 asn Asp.Net

Puiu

Regular
Joined
Oct 6, 2004
Messages
90
Hi there
I have created the following stored procedure on the sql server:

create procedure DownloadsBetweenDates
@BeginDate datetime,
@EndDate datetime
as
select * from Downloads where downloadDate between @BeginDate AND @EndDate


On my Webform there are 2 textboxes, one for the BeginDate and one for the EndDate, a button and of course, the report Viewer (crvDownloads)
I need to see the result of this StoredProcedure on my report (a Crystal Report)

I've managed to fill a datagrid with the data from the procedure, so the logging on the sql server went well but i just can't figure how to display the data on the report since i can't drag fields from the Database Fields in designer mode

Thank you
 
You could pass the dates to the crystal report using Formula fields. Open your crystal report and create a formula field, call it dateFrom, now drag the formula field onto the report. What is show on the report is @dateFrom. In the code behind before you call your report add the following piece of code:
Code:
 dim orpt as new crystalreport1
 orpt.DataDefinition.FormulaFields("dateFrom").Text = me.txtDateFrom.text

Just repeat the procedure for the dataTo and everything should be ok.

Mike55.
 
Thanx Mike, but i ment that in the 2 textboxes i insert the dates and i want my report to show me the downloads that took place between the 2 dates.

Anyway with Mike's help i've managed to see a part of the results, actualy only the last entry...how could i show all the results?
My code goes like this:

ReportDocument.SetDataSource(dsImages)

For Each row As DataRow In dsImages.Tables(0).Rows

rpt.DataDefinition.FormulaFields("Username").Text = "'" & row.Item("Username") & "'"

Next

crvImages.ReportSource = ReportDocument

This only shows me the last download. How can i see all the results ?
 
I've tried using a parameter field now without a stored procedure and this is the new problem:

I saw that my parameter field takes corectly the StartValue and the EndValue from the 2 textboxes, but i have another field(DownloadDate - a datetime field) taken from the database. I want my report to show me the downloads that took place between those 2 dates.

How do i link the DownloadDate to the parameter field so that the first download date is the StartValue and the last one - the EndValue
I've tried with the select Expert but my parameter field doesn't appear anywere
:confused:
 
Back
Top