Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > BOOK: Professional Crystal Reports for VS.NET
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Crystal Reports for VS.NET
This is the forum to discuss the Wrox book Professional Crystal Reports for Visual Studio .NET by David McAmis; ISBN: 9780764544033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Crystal Reports for VS.NET 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 Display Modes
  #1 (permalink)  
Old January 7th, 2005, 01:16 PM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp.net push model for crystal reports

I am attempting to use the push model for a crystal report from a asp.net project.
I am having two problems. First when I attempt to use a sql command I am able to create the report
but when I attempt to push the data to it I get a login failed error. When I correct this I get the original
data that was used to format the report not the modified data that I am attempting to push to it.
Here is the code.

Sub BindReport2()
        Dim oRpt As New CrystalReport1

        Dim myConnection As New SqlClient.SqlConnection
        myConnection.ConnectionString = "Server=WOODS1;Database=WEB_TEST;User ID=WebRep;Password=webrep;Trusted_Connection=False "
        Dim MyCommand As New SqlClient.SqlCommand
        MyCommand.Connection = myConnection
        MyCommand.CommandText = "select fname, lname, address1, city, state " & _
                                "from T1, T2 " & _
                                "where T1.empid = T2.empid and state = 'New York' "

        MyCommand.CommandType = CommandType.Text
        Dim MyDA As New SqlClient.SqlDataAdapter
        MyDA.SelectCommand = MyCommand
        Dim myDS As New DataSet
        'This is our DataSet created at Design Time
        MyDA.Fill(myDS, "Command")
        'You have to use the same name as that of your Dataset that you created during design time


        'oRpt.Database.Tables.Item("Command").SetDataSourc e(myDS)
        ' This is the Crystal Report file created at Design Time
        oRpt.SetDataSource(myDS)
        ' Set the SetDataSource property of the Report to the Dataset
        CrystalReportViewer1.ReportSource = oRpt
        'oRpt.SetDatabaseLogon("user","password","server", "database")
        oRpt.SetDatabaseLogon("WebRep", "webrep", "WOODS1", "web_test")
        CrystalReportViewer1.RefreshReport()

        ' Set the Crystal Report Viewer's property to the oRpt Report object that we created
    End Sub

My Second issue is similar though involves using a dataset. I am able to push the data to the report if
my dataset only contains one table if it contains more than one I get no data returned to the report.
Here is the code.

    Sub BindRep()
        Dim oRpt As New CrystalReport2
        Dim myConnection As New SqlClient.SqlConnection
        myConnection.ConnectionString = "Server=WOODS1;Database=WEB_TEST;User ID=WebRep;Password=webrep;Trusted_Connection=False "

        Dim strSQL As String = "select fname, lname, address1, city, state " & _
                                "from T1, T2 " & _
                                "where T1.empid = T2.empid and state = 'New York' "


        Dim objAdapter As New SqlClient.SqlDataAdapter(strSQL, myConnection)

        Dim objDataSet As New Dataset1
        objAdapter.Fill(objDataSet, "T1, T2")

        oRpt.SetDataSource(objDataSet)
        ' Set the SetDataSource property of the Report to the Dataset
        CrystalReportViewer1.ReportSource = oRpt
    End Sub

I have been able with the above code using a dataset that contains only one table to push the correct data
to the report. Any help on this issue whould be greatly appreciated.

Reply With Quote
  #2 (permalink)  
Old February 4th, 2005, 08:29 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you solved the problem yet?
I have the same problem. Using the PUSH method. Trying to export a crystal report to PDF with data selected by the user in dropdownlist controls. Problem: Login failed.
What did I do so far? I checked folder rights and granted read/write to all involved folders. I tryed connecting to the database via OLEDB as recommended by someone in a forum.
So far I have found the following documentation:
www.codeproject.com/aspnet/crystal_report.asp
support.microsoft.com/default.aspx?scid=kb;en-us;319264
http://aspalliance.com/490 (there is a second article here, too)

I just can't find out what my problem is.

Reply With Quote
  #3 (permalink)  
Old February 4th, 2005, 09:01 AM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The error is misleading if you do give it the password for the table all it does is return
the original results that you created the report with not the ones you want to push to it.
If you do this rpt.SetDataSource(ds.Tables(0)) it will work.
See http://www.asp.net/Forums/ShowPost.a...&PostID=792852 for a discussion on the
same topic where this came from.

Reply With Quote
Reply


Thread Tools
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
ASP.NET - Crystal Reports venkat999 ASP.NET 2.0 Professional 2 October 29th, 2006 08:39 AM
Crystal Reports Engine in Push Mode mike_abc Crystal Reports 0 April 17th, 2005 05:05 AM
push data to crystal report asp.net ewood Crystal Reports 0 January 7th, 2005 01:54 PM
asp.net push model for crystal reports ewood Classic ASP Basics 0 January 7th, 2005 01:12 PM



All times are GMT -4. The time now is 05:36 PM.


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