borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Runtime crystal report)Next Topic (VB6 Data Report-Passing a Variable) New Topic New Poll Post Reply
AndreaVB Forum : Reporting tools : Crystal Reports Error
Poster Message
zimcoder
Level: VB Lord


Registered: 27-10-2003
Posts: 225

icon Crystal Reports Error

Hi everyone

I have a .net web app that populates a dataset from a stored procedure and I'd like to display it in a crystal report.  .

I am getting an error and i hope someone can help
I have the crystal report viewer on the form and the following sub gets called on page load...


  
Private Sub FireReport1()

        Dim DataAdapter As SqlDataAdapter

        Dim DS As DataSet
        DataAdapter = New SqlDataAdapter("GetPollResults",ConfigurationSettings.AppSettings("cn"))

        DataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure

        DataAdapter.SelectCommand.Parameters.Add(New SqlParameter("@PollQuestionID", SqlDbType.Int))
        DataAdapter.SelectCommand.Parameters("@PollQuestionID").Value = Session("PollQuestionID")

        DS = New DataSet
        DataAdapter.Fill(DS)


        Dim orpt As New CrystalReport1
        orpt.SetDataSource(DS)
        cr1.ReportSource = orpt    'cr1 is crystal report viewer
        cr1.Visible = True
    End Sub


Here is the error message
Query Engine Error: 'C:\DOCUME~1\MYMACHINE~1\ASPNET\LOCALS~1\Temp\temp_b30b4aaf-89c3-4788-96d7-064c166ebe12.rpt'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.DataSourceException: Query Engine Error: 'C:\DOCUME~1\DEVELOPER~1\ASPNET\LOCALS~1\Temp\temp_b30b4aaf-89c3-4788-96d7-064c166ebe4.rpt'



____________________________
BrainBench ADO.NET and ASP.NET Certified Developer

28-01-2004 at 09:49 AM
View Profile Send Email to User Show All Posts | Quote Reply
Abhayakumar
Level: Guest

icon Re: Crystal Reports Error

Hi,
  
  First check whether the dataset elements are same as the column names that we get from our database (SP or Query).
The datasource setting of the report object should be changed to the Table of the dataset.  My problem was solved when i changed the datasource from the Dataset to the datatable of the dataset.
Eg:
  rpt1.SetDataSource(Ds.Tables(0))

Abhay

28-07-2004 at 09:14 AM
| Quote Reply
zimcoder
Level: VB Lord


Registered: 27-10-2003
Posts: 225
icon Re: Crystal Reports Error

Thanks man .. But what happens when my dataset has more than one datatable from which the data is being pulled for the report??

____________________________
BrainBench ADO.NET and ASP.NET Certified Developer

28-07-2004 at 10:50 AM
View Profile Send Email to User Show All Posts | Quote Reply
icapsan
Level: Guest

icon Re: Crystal Reports Error

If you're using several tables to show your report, you should use something like this:

rep1.Database.Tables("Table1").SetDataSource(ds1.Tables("table1"))
rep1.Database.Tables("Table2").SetDataSource(ds1.Tables("table2"))

The first table names (Table1, Table2) are the same as the ones you used in the report, and the second ones (table1, table2) are the same as the ones you used in the .Fill line.

I hope this information is useful.

01-08-2004 at 02:38 AM
| Quote Reply
nick2k4000
Level: Big Cheese

Registered: 29-09-2003
Posts: 20
icon Re: Crystal Reports Error

quote:
icapsan wrote:
If you're using several tables to show your report, you should use something like this:

rep1.Database.Tables("Table1").SetDataSource(ds1.Tables("table1"))
rep1.Database.Tables("Table2").SetDataSource(ds1.Tables("table2"))

The first table names (Table1, Table2) are the same as the ones you used in the report, and the second ones (table1, table2) are the same as the ones you used in the .Fill line.

I hope this information is useful.


why not use a query instead?

17-12-2004 at 04:05 PM
View Profile Send Email to User Show All Posts | Quote Reply
salaivedhan
Level: Trainee

Registered: 29-06-2005
Posts: 1
icon Re: Crystal Reports Error

Thank you everyone... Setting the datasource to the datatable solved the problem for me.

____________________________
Vedhan

29-06-2005 at 04:25 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Reporting tools : Crystal Reports Error
Previous Topic (Runtime crystal report)Next Topic (VB6 Data Report-Passing a Variable) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder