Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

populate data to a combobox in vb from a access database

$
0
0
Hi there,
I'm new to vb and I need to a thing. I've made a simple form by using vb.net. There I entered a combobox and I connected it to a access database. But when I'm running the program, when I click the drop down mark I won't get the details from the connected database. Can somebody tell me what's the wrong with my code?
here is the code
Imports System.Data
Public Class Form1
    Dim inc As Integer
    Dim MaxRows As Integer

    Dim con As New OleDb.OleDbConnection
    Dim ds As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Dim sql As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con.ConnectionString = "PROVIDER = Microsoft.ace.oledb.12.0;data source = ItemList.accdb"
        con.Open()

        sql = "SELECT * FROM Item_List"
        da = New OleDb.OleDbDataAdapter(sql, con)

        da.Fill(ds, "ItemList")
        con.Close()

        MaxRows = ds.Tables("ItemList").Rows.Count
        inc = -1

    End Sub


End Class



My vb version is vb 2005 express edition.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>