Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 January 7th, 2005, 02:12 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 log in 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
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
ASP.NET - Crystal Reports venkat999 ASP.NET 2.0 Professional 2 October 29th, 2006 09:39 AM
Crystal Reports Engine in Push Mode mike_abc Crystal Reports 0 April 17th, 2005 05:05 AM
asp.net push model for crystal reports ewood BOOK: Professional Crystal Reports for VS.NET 2 February 4th, 2005 10:01 AM
push data to crystal report asp.net ewood Crystal Reports 0 January 7th, 2005 02:54 PM



All times are GMT -4. The time now is 11:57 AM.


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