473,513 Members | 11,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dataview Copy

I have a dataview which I am assigning to a Datatable (I
am doing this because currently Crystal Reports will not
accept a dataview as a Reportsource -- The recommended
work-around is to assign dataview to datatable).

The dataview is being filtered. However when I assign it
to the datatable it is not filtered. I put some debug
code in and the Dataview has 8 records then I assign it to
a new datatable. When I check the row count of the
Datatable it has 34 rows...??
Shouldn't the dataview only copy the 8 filtered rows???

Dim dtCrystal As DataTable

dtCrystal = dvGrid.Table.Copy
oRpt.SetDataSource(dtCrystal)
crvReport.ReportSource = oRpt
crvReport.PrintReport()

Any help would be great
Dianna
Jul 21 '05 #1
2 9114
No, you are copying the underlying DataTable. As such, there's no filter.

I think you can foreach the rows in teh dataview and add them to the other
datatable.

Hth,

Bill
"Dianna K." <dk****@cbs.com> wrote in message
news:09****************************@phx.gbl...
I have a dataview which I am assigning to a Datatable (I
am doing this because currently Crystal Reports will not
accept a dataview as a Reportsource -- The recommended
work-around is to assign dataview to datatable).

The dataview is being filtered. However when I assign it
to the datatable it is not filtered. I put some debug
code in and the Dataview has 8 records then I assign it to
a new datatable. When I check the row count of the
Datatable it has 34 rows...??
Shouldn't the dataview only copy the 8 filtered rows???

Dim dtCrystal As DataTable

dtCrystal = dvGrid.Table.Copy
oRpt.SetDataSource(dtCrystal)
crvReport.ReportSource = oRpt
crvReport.PrintReport()

Any help would be great
Dianna

Jul 21 '05 #2
Hi Bill,

I tried however no such luck :( I am still getting the
entire un-filtered dataset.

MsgBox("Filter Count" & dvGrid.Count)

rptDS = OutDS.Clone 'copy structure Only

For Each objRow In dvGrid.Table.Rows
NewRow = rptDS.Tables(0).NewRow
rptDS.Tables(0).Rows.Add(NewRow)
Next

MsgBox("NEW TABLE " & rptDS.Tables(0).Rows.Count)

-----Original Message-----
No, you are copying the underlying DataTable. As such, there's no filter.
I think you can foreach the rows in teh dataview and add them to the otherdatatable.

Hth,

Bill
"Dianna K." <dk****@cbs.com> wrote in message
news:09****************************@phx.gbl...
I have a dataview which I am assigning to a Datatable (I
am doing this because currently Crystal Reports will not
accept a dataview as a Reportsource -- The recommended
work-around is to assign dataview to datatable).

The dataview is being filtered. However when I assign it to the datatable it is not filtered. I put some debug
code in and the Dataview has 8 records then I assign it to a new datatable. When I check the row count of the
Datatable it has 34 rows...??
Shouldn't the dataview only copy the 8 filtered rows???

Dim dtCrystal As DataTable

dtCrystal = dvGrid.Table.Copy
oRpt.SetDataSource(dtCrystal)
crvReport.ReportSource = oRpt
crvReport.PrintReport()

Any help would be great
Dianna

.

Jul 21 '05 #3

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

Similar topics

4
3563
by: Kevin Brown | last post by:
I simply want to copy the DataView and paste it into an email. What's the best way to accomplish that? I could obviously write the XML to a string and copy the string, but that's "ugly" for an...
3
9787
by: Brian Bischof | last post by:
I'm using a third-party tool that takes a DataTable as a parameter. I really need to pass it a DataView instead. When I try to explicitly cast the DataView as a DataTable I get an error that they...
3
17553
by: John Smith | last post by:
Hey folks, I have a Global DataSet which I use across my application. I use a DataView to give me the data that I want in a certain instance. Is there a way I can create the DataView so that...
1
5851
by: TaeHo Yoo | last post by:
Hi all, After sorting and grouping data using a dataview, then how to transfer the changed datatable in the dataview to a datatable in C#? Cheers
8
3870
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
36
4415
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
13
2072
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
2
475
by: Dianna K. | last post by:
I have a dataview which I am assigning to a Datatable (I am doing this because currently Crystal Reports will not accept a dataview as a Reportsource -- The recommended work-around is to assign...
4
1573
by: James | last post by:
Basically I have a DataGrid that I'm binding to the results of a stored procedure call. The recordset is fairly small. Initially I'm creating a DataSet from the results and binding it. There's a...
0
7254
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
7153
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
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7519
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
5677
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,...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.