Hi all, I am running Visual Studio.net 2003 with Crystal Reports 9. I am trying to pass a parameter to the SQL command as follows:
I understand that the C#.net command SetParameterValue(string, object) has some issues with service pack 1.
I am trying to pass a parameter into my Crystal Report SQL Command using the following:
In my AuctPurchaseList.cs file I have:
private void crystalReportViewer1_Load(object sender, System.EventArgs e)
{
AuctionPurchase auctReport = new AuctionPurchase();
auctReport.SetParameterValue("SaleIDParam1", "35");
//auctReport.SetParameterValue("SaleIDParam2", "46");
crystalReportViewer1.ReportSource = auctReport;
}
In my SQL Command I have:
SELECT TempSales.SaleID, TempSales.CustomerID, TempSales.SupplyID, TempSales.UnitsLots, TempSales.Lots, TempSales.Price FROM SeaMarket.TempSales WHERE TempSales.SaleID >= '{?SaleIDParam1}' ORDER BY TempSales.CustomerID, TempSales.SaleID
In my AuctionPurchase.rpt file (created by Crystal Reports design within Visual Studio.net 2003) I have a Parameter Field called SaleIDParam1 set as a string, with a default value of 35 (also with Allow multiple values checked and Descrete value checked). note:TempSales.SaleID is an integer in the database.
The report is printing ok but it is showing all values and not just those with a saleID of 35 and above. Which seems to suggest that the parameter passing is not working.
I know this is a dated package, but if there is someone who has been around in this space for some time.
with regards
Additional note:
Well, the good folks at Crystal Reports provided the link for service pack 2 and so I downloaded it and installed it. Unfortunately, it did not fix my issue. I would have thought that this was quite a basic procedure for VS 2003.net, but after doing much searching on the web there doesn't seem to be a lot around on this problem. The available use of various methods described at many sites is of course dependent on the available class libraries, which is dependent on the versions of CR, etc.
Maybe, I am looking at this all wrong but I thought the SQL command parameter passing could be achieved quite simply. I have seen it at postings on later versions of Crystal Reports.
I also have Crystal Reports XI R2 professional installed on my machine. I thought that maybe I could use that to generate the report and include the report in Visual Studio.net 2003 for build, but I yet to proove if this is possible, as VS 2003.net still uses .net Framework 1.1.
As there are plenty of legacy apps out there I am sure this would be an issue that could help many.
Hope someone (even a Crystal Reports expert) out there might have a suggestion?
cheers!