How to use Dataview to filter data from a datatable


In some situations,we need the extract data from datatable.Dataview can be used to filter the data from datatable.

This code shows how to use DataView to filter data from datatable.


Dim objDT As New DataTable
Dim objDV As DataView
Dim strQuery As String

'Query for filling data in datatable.
strQuery = "Select * from OITM"
'In GetData() function,query is fired and data is
'saved in objDT.
objDT = GetData(strQuery)
If objDT.Rows.Count > 0 Then
'The dataview objDV is filtered over the column
'code.All the records whose Code is BBAG are
'extracted from the datatable objDT and saved in
'dataview objDV.
objDV=New DataView(objDT,"Code='BBAG'","Code",DataViewRowState.CurrentRows)
If objDV.Count > 0 Then
'The value from 1st row and 1st column is displayed
MessageBox.Show(objDV.Item(0).Item(0))
End If
End If


Comments

Author: Narendra Dashpute04 Mar 2010 Member Level: Bronze   Points : 1

Hello
Nice piece of code
Thanks for sharing your knowledge with us.
I hope to see more good code from your side
This code will help lots of guys

Author: Ahmad Nauman27 Apr 2010 Member Level: Bronze   Points : 2

This one seems to me different type of post...one who dont know about it before may get useful information from this post...well i wanna say that The way how you tried to explain some posts at here seems to me different...there are certainly different posts at here,but i didnt find any post related to projects like 642-515...if someone have information about it,do tell me!Well any updates related to this post?if yes than do tell me!actually i came here while surfing net to get data related to projects of 642-611 , testking ccna and find this post different one...Is there anyone having information about 642-746?any updates?if yes than do tell me!









Author: john marsh29 Jun 2010 Member Level: Bronze   Points : 2

We continue to tell you about the developments that received diplomas at the 70-562 International Fishery Exhibition " RYBPROM -EXPO 2005 " held in November in Moscow. ASTU conjunction with the Southern Research Centre of RAS won the competition program, undertaken as part of the exhibition project , in the category " Innovation in the itil v3 braindumps fishing industry. " Development Department staff "Aquaculture and aquatic resources , 70-554 and laboratory Untz Sciences Aquaculture and biological resources "- "Creating a modern polnosistemnogo sturgeon fish farming , with a capacity of 100 tons of marketable fish "- was awarded the Medal of the Ministry of Agriculture . For details, we asked the heads of department " Aquaculture and mcitp dumps aquatic resources , Dr. biol . Sciences , prof. SV Ponomarev .



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: