hi,
What is basic use of Data View?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Aug 8, 2011, 11:34 AM
Vulpes has explained it beautifully
Here is a sample program of dataview.Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim ConnectionString As String = System.Configuration.ConfigurationSettings.AppSettings("dsn")
Dim con As OleDbConnection = New OleDbConnection(ConnectionString)
Dim com As OleDbCommand
Dim oledbda As OleDbDataAdapter
Dim ds As DataSet
Dim dt As DataTable
Dim str As String
Private Sub btnfilterdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfilterdata.Click
Try
con.Open()
str = "select * from student"
com = New OleDbCommand(str, con)
oledbda = New OleDbDataAdapter(com)
ds = New DataSet
oledbda.Fill(ds, "student")
Dim dv As DataView = New DataView(ds.Tables("student"))
dv.RowFilter = "smarks>70"
dv.Sort = "smarks asc"
ListBox1.DataSource = dv
ListBox1.DisplayMember = "smarks"
Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close()
End Sub
End Class
VulpesPosted Aug 5, 2011, 1:57 PM