VB.NET tutorial: DataAdapter DataSet objects

VB.NET tutorial: DataAdapter DataSet objects


DataAdapter DataSet objects

DataAdapter object can be used connected to a database through a Connection object. It has a method (Fill) that can fill data to a DataSet object. DataSet object stores tables and relationships among those tables in memory temporarily.
Example: Retrieve data from tblimages and populate the data to a listview control(Lstimages)

vb image viewer 

Sub displaydata()
        Dim ds As New DataSet
        Dim ad As OleDb.OleDbDataAdapter
        Dim i As Integer
        'Start connection
        'create DataAdapter object
        ad = New OleDb.OleDbDataAdapter("Select * From tblimages", dbcon.connection)
        'Fill data to DataSet object
        ad.Fill(ds, "tblimages")
        'clear listview
        'add columns
        For i = 0 To ds.Tables(0).Rows.Count - 1
            addDataToList(i, ds.Tables(0).Rows(i).Item(0), ds.Tables(0).Rows(i).Item(1))
End Sub


This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.