Connecting Tech Pros Worldwide Forums | Help | Site Map

populating Crystal Reports from DataGrid data

Brock
Guest
 
Posts: n/a
#1: Jul 21 '08
I am trying to populate a Crystal Report from data in my DataGrid.
The
reason for this is that I want the user to be able to change values
without updating the database, but still have their report reflect
the
values they anticipate committing to see hypothetical totals of
columns from a set of records. These records are displaying properly
on my DataGrid but I'm not sure how to get Crystal Reports 10 to use
as its datasource the dataset in memory that could be had directly
from the datagrid.

I'm guessing I need to Dim a new DataSet, populate it from the
datagrid, and set the new dataset as the datasource for CR. But how?


How can I specify that the Datagrid's DataSource property can be
explicitly cast as a DataSet object that CR can pick up. And how in
CR
do I tell it that this resultingDataSet is what it needs for the
report?


I found a snippet of code that may work as PART of the solution, but
I
need a little direction.
Private Sub FillDataSet(ByVal DataFromGrid As DataSet)
DataFromGrid = CType(dgEmployees.DataSource, DataSet)
End Sub


sloan
Guest
 
Posts: n/a
#2: Jul 21 '08

re: populating Crystal Reports from DataGrid data



And you really need to not multi post.

I've added some replies in the framework.aspnet newsgroup.




"Brock" <wade.brock@yahoo.comwrote in message
news:31f9946f-7410-4c25-96f4-d28b927b9063@l64g2000hse.googlegroups.com...
Quote:
>I am trying to populate a Crystal Report from data in my DataGrid.
The
reason for this is that I want the user to be able to change values
without updating the database, but still have their report reflect
the
values they anticipate committing to see hypothetical totals of
columns from a set of records. These records are displaying properly
on my DataGrid but I'm not sure how to get Crystal Reports 10 to use
as its datasource the dataset in memory that could be had directly
from the datagrid.
>
I'm guessing I need to Dim a new DataSet, populate it from the
datagrid, and set the new dataset as the datasource for CR. But how?
>
>
How can I specify that the Datagrid's DataSource property can be
explicitly cast as a DataSet object that CR can pick up. And how in
CR
do I tell it that this resultingDataSet is what it needs for the
report?
>
>
I found a snippet of code that may work as PART of the solution, but
I
need a little direction.
Private Sub FillDataSet(ByVal DataFromGrid As DataSet)
DataFromGrid = CType(dgEmployees.DataSource, DataSet)
End Sub
>

Brock
Guest
 
Posts: n/a
#3: Jul 22 '08

re: populating Crystal Reports from DataGrid data


In all due respect I am simply trying to understand the concepts for
which I am granted a newbie at. Different individuals frequent
different newsgroups and each has their own perspective on how to
assit with problem solving. I was having difficulty understanding how
to begin, even remotely, to construct code to capture the session
information and make it available to Crystal Reports, plus the
challenge of how to on the CR side to let it know where the dataset
resides and how to capture it as its datasource. I meant no offense in
double posting, I'm just a beginner trying to understand a 'real-
world' programming challenge that the textbooks due a pitiful job of
presenting. And again thanks for taking interest in my post. If you
can help any further I would love to continue, but the solution as
presented is just over my head.
thanks Brock

On Jul 21, 3:21*pm, "sloan" <sl...@ipass.netwrote:
Quote:
And you really need to not multi post.
>
I've added some replies in the framework.aspnet newsgroup.
>
"Brock" <wade.br...@yahoo.comwrote in message
>
news:31f9946f-7410-4c25-96f4-d28b927b9063@l64g2000hse.googlegroups.com...
>
>
>
Quote:
I am trying to populate a Crystal Report from data in my DataGrid.
The
reason for this is that I want the user to be able to change values
without updating the database, but still have their report reflect
the
values they anticipate committing to see hypothetical totals of
columns from a set of records. These records are displaying properly
on my DataGrid but I'm not sure how to get Crystal Reports 10 to use
as its datasource the dataset in memory that could be had directly
from the datagrid.
>
Quote:
I'm guessing I need to Dim a new DataSet, populate it from the
datagrid, and set the new dataset as the datasource for CR. But how?
>
Quote:
How can I specify that the Datagrid's DataSource property can be
explicitly cast as a DataSet object that CR can pick up. And how in
CR
do I tell it that this resultingDataSet is what it needs for the
report?
>
Quote:
I found a snippet of code that may work as PART of the solution, but
I
need a little direction.
* *Private Sub FillDataSet(ByVal DataFromGrid As DataSet)
* * * *DataFromGrid = CType(dgEmployees.DataSource, DataSet)
* *End Sub- Hide quoted text -
>
- Show quoted text -
Steve Gerrard
Guest
 
Posts: n/a
#4: Jul 22 '08

re: populating Crystal Reports from DataGrid data


Brock wrote:
Quote:
In all due respect I am simply trying to understand the concepts for
which I am granted a newbie at. Different individuals frequent
different newsgroups and each has their own perspective on how to
assit with problem solving.
You are forgiven (just this once) for not knowing the difference between
multi-posting and cross-posting.

If you feel your question must be posted to more than one newsgroup, do so the
same way you would send an email to two different people. Put the first
newsgroup in the address, followed by a comma, followed by the second one.

That way, when someone (such as sloan) replies in one newsgroup, readers in the
other group can also see the reply. Otherwise, you just get chaos.

I will reply to your question only briefly, since sloan may have already
answered it. (See why cross-posting would be better?)

If the datagrid can accept a dataset as its datasource, and a crystal report can
as well, then you need only set one to the other. No copying of data is needed.
You might need nothing more than

MyCrystalReport.SetDataSource(MyDataGrid.DataSourc e)

I don't actually use crystal reports, but a look through the documentation
suggests that something along those lines would get it done.


Closed Thread


Similar Visual Basic .NET bytes