473,396 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't get the Crystal Reports Viewer to bind with my dataset.

I am in the same boat as Moondog on the 2nd July.
I have a report designed against a dataset.
Proved the datasset is OK by dropping a datagrid onto the form and it binds
OK to the data.
But the report is empty (except for headers). My method is similar to
Moondog except the dataset is based on a SProc.
The dataset is instantiated in FormA, passed to a DataHandling class which
fills it. by executing the SProc
it is then passed to the report form in the constructor.
The constructor then passes it down to a subroutine 'loadreport' which
attempts to bind it to the report viewer
Code is :
Private Sub loadreport(ByRef dsevents As dsReportEvent)

' Called by new(ByRef dsevents As dsReportEvent)

Me.dg1.DataSource = dsevents

Me.dg1.DataMember = "Table"'Datagrid sanity check

mRpt = New rptEventReport 'report class underlying report based on dsEvents

mRpt.SetDataSource(dsevents)

Me.crvMain.ReportSource = mRpt 'setting the viewer

End Sub

Any help would be appreciated.
Thanks
Bob
Nov 20 '05 #1
3 5939
Hi Brian,
Thanks for your reply.
No Joy.
I coded:
Private Sub loadreport(ByRef dsevents As dsReportEvent)

Dim crReportDocument As rptEventReport

crReportDocument = New rptEventReport

Dim ds As DataSet

ds = dsevents 'NOTE here I am still pointing to my original dataset.

Dim dstest As String = ds.GetXml 'dstest shows well formed doc with data

crReportDocument.SetDataSource(ds)


Me.crvMain.ReportSource = crReportDocument

Me.crvMain.Visible = True

End Sub

The test string showed an xml doc with data.

I do have dates in the data.
I'll alter the sproc / dataset / report to give a one integer field rowset
and see if that helps.
If it does then I'll build up from there.
If it is data then this control is not much use.
Is there any 3rd party viewer around that anybody knows of?
Thanks
Bob

"BrianDH" <Br*****@discussions.microsoft.com> wrote in message
news:7E**********************************@microsof t.com...
Try this.
Dim crReportDocument As rptEventReport
crReportDocument = New rptEventReport
Dim dsevents As DataSet = "get your dataset values"
Dim strTests As String = dsevents.GetXml ' break point here view/test your DS XML crReportDocument.SetDataSource(dsevents)
CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.Visible = True

If this does not work.
Question: Are you using any formulas? running totals? also date time fields can give you fits with CR.
hope that helps.

B
"Bob Clegg" wrote:
I am in the same boat as Moondog on the 2nd July.
I have a report designed against a dataset.
Proved the datasset is OK by dropping a datagrid onto the form and it binds OK to the data.
But the report is empty (except for headers). My method is similar to
Moondog except the dataset is based on a SProc.
The dataset is instantiated in FormA, passed to a DataHandling class which fills it. by executing the SProc
it is then passed to the report form in the constructor.
The constructor then passes it down to a subroutine 'loadreport' which
attempts to bind it to the report viewer
Code is :
Private Sub loadreport(ByRef dsevents As dsReportEvent)

' Called by new(ByRef dsevents As dsReportEvent)

Me.dg1.DataSource = dsevents

Me.dg1.DataMember = "Table"'Datagrid sanity check

mRpt = New rptEventReport 'report class underlying report based on dsEvents
mRpt.SetDataSource(dsevents)

Me.crvMain.ReportSource = mRpt 'setting the viewer

End Sub

Any help would be appreciated.
Thanks
Bob

Nov 20 '05 #2
OK Problem Solved.
You have to use the overloaded version of the dataadapter fill command.
ie.
Dim cmdConn As New SqlClient.SqlCommand("proc_GetEventReportData",
NewSqlClient.SqlConnection(strConnection))

cmdConn.Parameters.Add(New SqlClient.SqlParameter("@strIDList",
SqlDbType.NVarChar))

cmdConn.Parameters("@strIDList").Value = mstrUnitList
cmdConn.CommandType = CommandType.StoredProcedure
Dim da As New SqlClient.SqlDataAdapter(cmdConn)
Dim ds As New dsReportEvent
da.Fill(ds, "ReportEvent")
Dim rd As New rptEventReport
rd.SetDataSource(ds)

The big 'break through' was realising that "ReportEvent" was needed.
The documentation alludes to this but leaves the impression that is it
mainly for table verification.
This HAD to be the name of the Element that was inside my typed dateset.
My element was handrolled and not actually a table so it seemed
reasonable to use the default constructor and accept the generated table
name "Table".
Alas no.
Moondog, if your out there, good luck.
regards
Bob

Bob Clegg wrote:
Hi Brian,
Thanks for your reply.
No Joy.
I coded:
Private Sub loadreport(ByRef dsevents As dsReportEvent)

Dim crReportDocument As rptEventReport

crReportDocument = New rptEventReport

Dim ds As DataSet

ds = dsevents 'NOTE here I am still pointing to my original dataset.

Dim dstest As String = ds.GetXml 'dstest shows well formed doc with data

crReportDocument.SetDataSource(ds)


Me.crvMain.ReportSource = crReportDocument

Me.crvMain.Visible = True

End Sub

The test string showed an xml doc with data.

I do have dates in the data.
I'll alter the sproc / dataset / report to give a one integer field rowset
and see if that helps.
If it does then I'll build up from there.
If it is data then this control is not much use.
Is there any 3rd party viewer around that anybody knows of?
Thanks
Bob

"BrianDH" <Br*****@discussions.microsoft.com> wrote in message
news:7E**********************************@microsof t.com...
Try this.
Dim crReportDocument As rptEventReport
crReportDocument = New rptEventReport
Dim dsevents As DataSet = "get your dataset values"
Dim strTests As String = dsevents.GetXml ' break point here view/test your


DS XML
crReportDocument.SetDataSource(dsevents)
CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.Visible = True

If this does not work.
Question: Are you using any formulas? running totals? also date time


fields can give you fits with CR.
hope that helps.

B
"Bob Clegg" wrote:

I am in the same boat as Moondog on the 2nd July.
I have a report designed against a dataset.
Proved the datasset is OK by dropping a datagrid onto the form and it
binds
OK to the data.
But the report is empty (except for headers). My method is similar to
Moondog except the dataset is based on a SProc.
The dataset is instantiated in FormA, passed to a DataHandling class
which
fills it. by executing the SProc
it is then passed to the report form in the constructor.
The constructor then passes it down to a subroutine 'loadreport' which
attempts to bind it to the report viewer
Code is :
Private Sub loadreport(ByRef dsevents As dsReportEvent)

' Called by new(ByRef dsevents As dsReportEvent)

Me.dg1.DataSource = dsevents

Me.dg1.DataMember = "Table"'Datagrid sanity check

mRpt = New rptEventReport 'report class underlying report based on
dsEvents
mRpt.SetDataSource(dsevents)

Me.crvMain.ReportSource = mRpt 'setting the viewer

End Sub

Any help would be appreciated.
Thanks
Bob


--
Please take out the garbage before using reply address.

Nov 20 '05 #3
Hmmm, I think I did try that method bclegg, but still had no luck.

But I did manage to get it working. Here's how:

In my code after I get my dataset I run this line once:

myDataSet.WriteXmlSchema("C:\MyReport.xsd")

This creates a file called MyReport.xsd that contains the description
of my data. Next I create a new Crystal Report using MyReport.xsd as
my ADO.NET (XML) source. Once the new report is created you can
delete MyReport.xsd, and also delete the line of code that created the
xsd file. The new report created will then accept my dataset during
runtime.

Dominic Isaia (Moondog)
di****@earthlink.net
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rick Thiel | last post by:
Hello, I am trying to build a Crystal report VisualStudio.NET for an ASP.NET application. I would like to build a report that doesn't connect to any particular database at design time because I...
0
by: Jason | last post by:
We are developing a VB.NET database application, using windows forms and Microsoft Access. The application requires dynamic reports, where the users change data on the forms, if a report is...
2
by: Jonathan | last post by:
Hi all, It's my first post here, so be kind :) I got a little application that keep track of a small inventory, everything was going great until came the time to make some types of reports. I...
3
by: Khurram | last post by:
Hi, I am trying to use Crystal Reports with ASP.NET. I created a dataset and tried to display it in the report but nothing came up. I did not get an exception either. I know that the dataset is...
0
by: Moondog | last post by:
Here's my VB.NET code: Dim RV As New frmReportViewer 'This is the form containing the 'Crystal Report Viewer Dim Rep As New DetailsReport 'DetailsReport is the name of my 'report. It is...
0
by: Monali | last post by:
Hi, I created a ASP.NET crystal reports web site in VS 2005. I wanted to display the data in a DataSet in the Crystal Reports viewer control. I am getting the DataSet from another dll. The...
2
by: Simone | last post by:
Hello I am new to this :) I have created a crystal reports and tried using the Crystal Report Viewer but when I try to preview the report it prompts me for a user name and password. I am using...
6
by: Simone | last post by:
Hello Here is my issue, I created a crystal report using a data set from my xsd. Then I created a page with the crystal report viewer control and bound the report to it. When I try to view...
6
by: Bjorn Sagbakken | last post by:
Hi I have done some work with VS 2005 but no report-issues yet. Now I want to step up, and implement reports for printing and PDF export. I have just briefly studied the build-in report...
0
by: newkhan | last post by:
Hi, I have worked with RDLC reports on visual studio.net 2005 and now i am using crystal reports. I want to add data from single table using ado.net and in the crystal report I have added the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.