473,378 Members | 1,390 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,378 software developers and data experts.

copy filtered datarow to datatable's datarow

Expand|Select|Wrap|Line Numbers
  1.  Dim dtUn As DataTable
  2.         dtUn= New DataTable
  3.         dtUn = BindICUN()
  4.         Dim i As Integer
  5.         Dim irow As DataRow
  6.         Dim mailBody As String = ""
  7.  
  8.         Dim myRow As DataRow
  9.         Dim rowSet As DataRow()
  10.         rowSet = dtUn.Select("Distinct Member_id is not null")
  11.  
  12.         Dim dt As DataTable
  13.         dt = New DataTable
  14.         dt.Columns.Add(New DataColumn("Trans_ID", GetType(Integer)))
  15.  
  16.         Dim dr As DataRow
  17.         'dr("Trans_ID") = myRow("Trans_ID")
  18.         For Each myRow In rowSet
  19.             dr = dt.NewRow()
  20.             dr.ItemArray = myRow.ItemArray()
  21.             dt.Rows.Add(dr)
  22.         Next
  23.       return dt
what wrong with my code above? I just want to copy filtered record to another datatable.

Actually what i wan is bind the filtered record to datagridview, since after filter I don't how to bind using the datarow, so i copy datarow to rows in another datatable so can bind. Any better idea by giving sample code? or who can guide me on how to modify code above? Any help much appreciated. Thanks.
Aug 13 '08 #1
1 1485
Curtis Rutland
3,256 Expert 2GB
You need to use the .ImportRow method:
http://support.microsoft.com/kb/308909
Aug 13 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

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...
0
by: Kelvin | last post by:
Hi All, Due to can't insert new row between row and row while current DataTable looping. In order to solve the problem, I need to clone it as new DataTable, while the DataTable Looping, it also...
3
by: ypul | last post by:
can anyone tell me please .. how to copy one datarow from one datatable to another.. I want to extract some specific rows from one datatable and put into antoher .... "...
0
by: Bennett Haselton | last post by:
If I have just filled a DataTable in a typed DataSet with a single row, is there a way I can make a copy of that row, so that I can clear the DataTable in that DataSet and use it for another query,...
2
by: Craig G | last post by:
i have a filter that runs on a dataset Dim drFilteredRows As DataRow() drFilteredRows = dsResults.Tables(0).Select(strFilter) This works grand and returns records but i want to add these...
2
by: Li Pang | last post by:
Hi, I created a datatable (dt1) of 3 columns A, B, C, and I want to copy this datatable into another datatable (dt2) but without the column B. How to do this? Thanks in advance
6
by: JIM.H. | last post by:
Hello I have; DataRow dr= dataSet11.myTable.NewRow(); And I am filling the fields of this datarow. Now I need to create a copy of this row as drCopy and change a few fields and add both to...
5
by: samoore33 | last post by:
I use the code below to search through a DataSet: Dim t As DataTable t = result.Tables("State") Dim strExpr As String strExpr = "id = '" & theState.ToString() & "'" Dim foundRows() As DataRow...
6
by: Pete Wittig | last post by:
Hi, I have a DataTable and I want to get a subset of the rows within it. I use the Select method to get my subset and the results are in a DataRow. I want to put those Rows back into a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.