|
-
Jun 22nd, 2005, 10:22 AM
#1
Thread Starter
Junior Member
Data row
Would someone please point out my problem here, and supply the correct code.
=============I think i messed up around the for each statement================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cnn As New SqlConnection("Data Source=DESKTOP; Initial Catalog=Northwind; Trusted_Connection=yes")
cnn.Open()
Dim da As New SqlDataAdapter("Select * From Customers", cnn)
Dim ds As New DataSet
da.Fill(ds, "Customers")
Dim dr As DataRow
For Each dr In ds.Tables.Item("Customers").Rows
ListBox1.DataSource = dr
ListBox1.DataBind()
Next
End Sub
End Class
-
Jun 22nd, 2005, 03:13 PM
#2
Frenzied Member
Re: Data row
well you are rebinding the one list for each data row. That effectively clears what just went in and repopulates the list with the data in the current row. Giving you whatever is in the last row.
try setting the data table as the data source and setting display and value members to the column you want there.
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|