简体   繁体   中英

Passing a parameter to crystal report in visual studio 2012

Hi everyone i want to pass a parameter to my crystal report, the parameter came from a query string, the problem is i don't how to pass it can someone help please This is my sql statement

      SELECT        dbo.Item.Name, dbo.Payment.Date, dbo.BID.WinningPrice,   dbo.Item.Price, dbo.Item.Condition, dbo.Member.FirstName, dbo.Member.LastName, 
                     dbo.Member.Email, dbo.Payment.PaymentID, dbo.Payment.BidID
    FROM            dbo.Payment INNER JOIN
                     dbo.BID ON dbo.Payment.BidID = dbo.BID.BidID INNER JOIN
                     dbo.Auction ON dbo.BID.AuctionID = dbo.Auction.AuctionID INNER JOIN
                     dbo.Item ON dbo.Auction.ItemID = dbo.Item.ItemID INNER JOIN
                     dbo.Seller ON dbo.Item.SellerID = dbo.Seller.SellerID INNER JOIN
                     dbo.Member ON dbo.Seller.MemberID = dbo.Member.MemberID
     Where Payment.BidID =@bid

And below my crystal report code

   If Not Page.IsPostBack Then
        CrystalReportViewer1.Visible = True
        Dim rDoc As New ReportDocument()


        ' Crystal Report Name
        rDoc.Load(Server.MapPath("Invoice.rpt"))
        ' Your .rpt file path

        'set dataset to the report viewer.
        CrystalReportViewer1.ReportSource = rDoc


    End If

Hi try to give a look at this article, i explains how to pass patameters to crystal reports from code.

VB.NET Crystal Reports String parameter

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM