|
-
Oct 17th, 2010, 08:28 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Databinding to a WPF listbox
Hi everyone,
I have a listbox on a window that i simply want to fill with conditional data from a database that scans a customer database and counts off the number of entries that don't have an email address associated with them and displays the company name in a listbox - here's the code:
Code:
Dim con As New SqlClient.SqlConnection
Dim ds As New DataSet
Dim da As SqlClient.SqlDataAdapter
Dim sql As String
con.ConnectionString = connectstring
con.Open()
sql = "select Company_Name FROM Customer where Sales_Rep = '" & getsalesrepname & "' AND (Email IS NULL OR Email = '')"
da = New SqlClient.SqlDataAdapter(sql, con)
da.Fill(ds, "Customer")
lbCompaniesMissing.ItemsSource = ds.Tables(0).Rows()
lbCompaniesMissing.DisplayMemberPath = "Company_Name"
con.Close()
The problem is that it appears to fill the listbox with the correct number of rows, but they are blank - if i highlight the first 'blank' entry and count them off by simply scrolling down, it gives me the expected 59 rows that the above query returns in my case - just no text is displayed in the listbox.....
any ideas would be appreciated...as usual i'll keep hunting for a solution myself and if i find it i'll post it here.
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
|