Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 14th, 2004, 01:21 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Hyderabad, , India.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default crystal Reports in asp.net page

Reqd help urgently::::

  I want to know how to create a crystal report from asp.net page using crystalreportviewer .Now this works fine. But the problem is
1.How to pass runtime parameter to the crystal report & get selective records displayed

   eg. I want the details of John alone from the Employee table in SQL server database.I am using vb.net as code file
   Pl help asap;
Would be grateful as project deadlines are close

Reply With Quote
  #2 (permalink)  
Old July 14th, 2004, 01:48 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

http://p2p.wrox.com/topic.asp?TOPIC_ID=6389

Always:),
Hovik Melkomian.
Reply With Quote
  #3 (permalink)  
Old August 17th, 2004, 08:03 AM
rsk rsk is offline
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi

i use a dataset to set up the query and then pass the dataset to the crystal report viewer:

Dim newRpt As GeneralReport
        newRpt = New GeneralReport

        Make_con() 'sub that sets the connection to sql
        sqlCommand.Connection = sqlCon
        strQuery = "Select * From tableName"

        Dim sqlDA As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(strQuery, sqlCon)

        strWhere = ""

        'SET UP THE QUERY HERE

        strQuery = strQuery & strWhere
        sqlDA.SelectCommand.CommandText = strQuery
        Dim sqlDS As New DataSet
        sqlDA.Fill(sqlDS)
        Me.cvReport.Visible = True
        newRpt.SetDataSource(sqlDS.Tables(0))
        cvReport.ReportSource = newRpt
        sqlCon.Close()

hope this helps u.

Reply With Quote
  #4 (permalink)  
Old August 20th, 2004, 01:08 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

you ca create a crystal report in asp.net by

1. Create a new web form by right clicking your project and select add web form. name the form.

2. From a tool box drag and drop crystalreportviewer on to the form.
3. Add ur existing crystal report to your project by righting ur project and select add existing item choose ur report.

4. Drag and drop reportdocument from component in the tool box.
A pop window shows ur added report and all the exisiting report.
choose ur report and click ok. Add one textbox(txtbox) to hold your parameter.

5. Add the below.


        ' Binding by report object.
        'CRobj is a report object either u can pass the path or pass the class
        'testorganization_para() is the automatically generated class of report.

        Dim CRobj As New ReportDocument()
        Dim CRdiscretevalue As New CrystalDecisions.Shared.ParameterDiscreteValue()
        Dim CRParameterFieldDefinitions As ParameterFieldDefinitions
        Dim CRParameterFieldLocation As ParameterFieldDefinition
        Dim CRparametervalues As New CrystalDecisions.Shared.ParameterValues()

        ' Get report parameter's collection

        CRobj = New testorganization_para()
        faccrystalreport.ReportSource = CRobj ' faccrystalreport is a crystalreportviewer
        CRParameterFieldDefinitions = CRobj.DataDefinition.ParameterFields
        CRParameterFieldLocation = CRParameterFieldDefinitions.Item("organization city")
        CRparametervalues = CRParameterFieldLocation.CurrentValues

        Dim CRParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue()
'txtbox is your textbox id from where you are passing ur parameter to the report.
        CRParameterDiscreteValue.Value = txtbox.text
        CRparametervalues.Add(CRParameterDiscreteValue)
        CRParameterFieldLocation.ApplyCurrentValues(CRpara metervalues)
        '
        ' Set the Crytal Report Viewer control's source to the report document.
        '

        faccrystalreport.ReportSource = CRobj

        'connection string and table information declaration

        Dim tablelongoninfo As New CrystalDecisions.Shared.TableLogOnInfo()
        Dim con As New CrystalDecisions.Shared.ConnectionInfo()

        Dim CRdatabase As Database
        Dim CRtable As Tables
        Dim cretable As Table

' Enter ur server name and databasename here
        con.ServerName = ""
        con.DatabaseName = ""
        con.UserID = "sa"
        con.Password = ""
        CRdatabase = CRobj.Database
        CRtable = CRdatabase.Tables

        For Each cretable In CRtable

            tablelongoninfo = cretable.LogOnInfo
            tablelongoninfo.ConnectionInfo = con
            cretable.ApplyLogOnInfo(tablelongoninfo)

        Next

        faccrystalreport.ReportSource = CRobj
'---------------------------------------------------------------------


this will work.

Please let me know about it.

thank you




Reply With Quote
  #5 (permalink)  
Old March 7th, 2006, 04:26 PM
Registered User
 
Join Date: Mar 2006
Location: Oklahoma City, OK, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
I am very new to asp.net and have a chance to look ur code for asp.net and crystal reports. Can you please tell me the following line in your code?

CRParameterFieldLocation = CRParameterFieldDefinitions.Item("organization city")
What is that "organization city"? Is it a database field?

Thanks! Your help will be appreciated.

Quote:
quote:Originally posted by shamala
 hi,

you ca create a crystal report in asp.net by

1. Create a new web form by right clicking your project and select add web form. name the form.

2. From a tool box drag and drop crystalreportviewer on to the form.
3. Add ur existing crystal report to your project by righting ur project and select add existing item choose ur report.

4. Drag and drop reportdocument from component in the tool box.
A pop window shows ur added report and all the exisiting report.
choose ur report and click ok. Add one textbox(txtbox) to hold your parameter.

5. Add the below.


        ' Binding by report object.
        'CRobj is a report object either u can pass the path or pass the class
        'testorganization_para() is the automatically generated class of report.

        Dim CRobj As New ReportDocument()
        Dim CRdiscretevalue As New CrystalDecisions.Shared.ParameterDiscreteValue()
        Dim CRParameterFieldDefinitions As ParameterFieldDefinitions
        Dim CRParameterFieldLocation As ParameterFieldDefinition
        Dim CRparametervalues As New CrystalDecisions.Shared.ParameterValues()

        ' Get report parameter's collection

        CRobj = New testorganization_para()
        faccrystalreport.ReportSource = CRobj ' faccrystalreport is a crystalreportviewer
        CRParameterFieldDefinitions = CRobj.DataDefinition.ParameterFields
        CRParameterFieldLocation = CRParameterFieldDefinitions.Item("organization city")
        CRparametervalues = CRParameterFieldLocation.CurrentValues

        Dim CRParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue()
'txtbox is your textbox id from where you are passing ur parameter to the report.
        CRParameterDiscreteValue.Value = txtbox.text
        CRparametervalues.Add(CRParameterDiscreteValue)
        CRParameterFieldLocation.ApplyCurrentValues(CRpara metervalues)
        '
        ' Set the Crytal Report Viewer control's source to the report document.
        '

        faccrystalreport.ReportSource = CRobj

        'connection string and table information declaration

        Dim tablelongoninfo As New CrystalDecisions.Shared.TableLogOnInfo()
        Dim con As New CrystalDecisions.Shared.ConnectionInfo()

        Dim CRdatabase As Database
        Dim CRtable As Tables
        Dim cretable As Table

' Enter ur server name and databasename here
        con.ServerName = ""
        con.DatabaseName = ""
        con.UserID = "sa"
        con.Password = ""
        CRdatabase = CRobj.Database
        CRtable = CRdatabase.Tables

        For Each cretable In CRtable

            tablelongoninfo = cretable.LogOnInfo
            tablelongoninfo.ConnectionInfo = con
            cretable.ApplyLogOnInfo(tablelongoninfo)

        Next

        faccrystalreport.ReportSource = CRobj
'---------------------------------------------------------------------


this will work.

Please let me know about it.

thank you




Reply With Quote
  #6 (permalink)  
Old December 31st, 2006, 11:07 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi
I've been trying to create report but i found this problem

        Dim rpt As New CrystalReport()
   *** rpt.setDataSource(DA) ***
        CrystalReportViewer1.ReportSource = rpt
        conn.Close()

The report instance that i've create doesn't have method 'setDataSource', so error occurs when i run the application.

Please help,
Thanks in advance

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 1.1,VB.NET,crystal reports, SQl server gvi Crystal Reports 1 September 11th, 2008 02:55 AM
Crystal Reports in asp.net 1.1 Pramods ASP.NET 1.0 and 1.1 Professional 0 June 14th, 2007 08:27 AM
Crystal Reports in ASP.NET bmains Crystal Reports 2 March 27th, 2004 04:45 AM



All times are GMT -4. The time now is 08:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.