Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 30th, 2007, 04:46 AM
Registered User
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Crystal Report problem

Hello
      i am using crystal report. i have placed tow dropdownlist on my form. Now the dropdownlist contains the category.the user will select the category . the code is:

  Dim i As Integer = Val(cat.SelectedItem.Text)
        Dim j As Integer = Val(cat1.SelectedItem.Text)
        Dim bcat As Integer
        For bcat = i To j Step 1
            Dim cmd As SqlCommand = New SqlCommand("select bincard,location,b_cat,opening_stock,opening_value ,rec_qnty,rec_value,iss_qnty,iss_value,closing_sto ck,closing_value from invitmas where b_cat=" & bcat & " order by b_cat,bincard", myc.conn)
            Dim ada As SqlDataAdapter = New SqlDataAdapter
            ada.SelectCommand = cmd
            Dim ds As DataSet = New DataSet
            ada.Fill(ds, "invitmas")
            Dim myreport As ReportDocument = New ReportDocument
            myreport.Load("D:\MY DOC\StorePurchase\Stockcat.rpt")
            myreport.SetDataSource(ds)
            'ds.Dispose()
            stkcat.Visible = True
            stkcat.ReportSource = myreport
            stkcat.DataBind()

        Next bcat

This code is working correctly but the problem is that Only last record is adding to crystal report.No error is Coming.
So what should i do get all records.

Rathish



 
Old May 30th, 2007, 01:34 PM
Registered User
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can anyone plz help me out its urgent?........

 
Old May 30th, 2007, 01:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. well.. you are inserting a dataset (into CR) with only one record.. the last one...

the problem is in the for... why are you doing a for loop that select only one kind of records and add it to the CR one at a time??

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old May 31st, 2007, 05:41 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yeap moslty thats true..

if the "bcat" field is a key.. i suppose you should change your where condition.. ... and remove the for loop... ur statement should end with bcat> i and bcat <j (or use between off course :)

Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"





Similar Threads
Thread Thread Starter Forum Replies Last Post
C# Crystal Report Problem abhijeetballal C# 1 September 10th, 2013 02:18 AM
Problem In Crystal report baludotnet Crystal Reports 1 December 21st, 2006 03:04 AM
Problem with Crystal Report prankur ASP.NET 1.0 and 1.1 Professional 0 January 7th, 2006 03:45 AM
Crystal Report Problem harland Crystal Reports 0 November 19th, 2004 02:09 AM
Problem in crystal report Chatanya Crystal Reports 1 October 7th, 2004 03:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.