hi,
What is basic use of Data View?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Aug 8, 2011, 7:34 AM EDT
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
VulpesRank #55 · 29.2K reputationPosted Aug 5, 2011, 9:57 AM EDT