Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

Selecting a single column from database table and populate it in a listbox

$
0
0
i have a code here that i want to show the data from the database of a certain column,
HOWEVER THE LISTBOX SHOWS:
System.Data.DataRow
System.Data.DataRow
System.Data.DataRow
System.Data.DataRow
System.Data.DataRow

instead of the data in the database.

this is my current code:

Code:

Dim conn As SqlCeConnection = Nothing
        Try
            conn = New SqlCeConnection("Data Source=" & userSpecifiedPath)
            conn.Open()
            Dim cmd As SqlCeCommand = conn.CreateCommand()
            Dim dAdp As SqlCeDataAdapter = New SqlCeDataAdapter()
            Dim ds As New DataSet

            cmd.CommandText = String.Format("SELECT STATUS FROM DELIVERY")
            dAdp.SelectCommand = cmd
            cmd.ExecuteReader()

            dAdp.Fill(ds)
            ListBox2.DataSource = ds.Tables(0)
            cmd.ExecuteNonQuery()
        Catch ex As Exception
        Finally
            conn.Close()
        End Try

ALREADY SOLVED :)

Viewing all articles
Browse latest Browse all 27355

Trending Articles



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