473,402 Members | 2,064 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,402 software developers and data experts.

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 9097
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
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
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
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
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
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
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
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
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
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.