Home All Groups Group Topic Archive Search About

Listbox idiotic example

Author
24 Jan 2006 9:02 PM
Peter Lux
Ok.. all I'm trying to do is get a list of non-system tables from a Sqlbase
db into a listbox. The following returns many rows that say:
System.Data.DataRowView
System.Data.DataRowView
..
..
..
Here's the code:

hQuest.ConnectionString = "DSN=this worksfine.."

hQuest.Open()

sSelect = "select name from sysadm.systables where name not like 'SYS%' "

Dim Cmd As New Odbc.OdbcCommand(sSelect, hQuest)

da.SelectCommand = Cmd

Dim ds As DataSet = New DataSet

da.Fill(ds)

lbTable.DataSource = ds.Tables(0)

hQuest.Close()

What's wrong? Is it the data adapter or the data set?

Author
24 Jan 2006 9:20 PM
Kerry Moorman
Peter,

Try assigning a column name from the table to the listbox's DisplayMember
property. For example:

lbTable.DisplayMember = "TableName"

Kerry Moorman

Show quoteHide quote
"Peter Lux" wrote:

> Ok.. all I'm trying to do is get a list of non-system tables from a Sqlbase
> db into a listbox. The following returns many rows that say:
> System.Data.DataRowView
> System.Data.DataRowView
> ..
> ..
> ..
> Here's the code:
>
> hQuest.ConnectionString = "DSN=this worksfine.."
>
> hQuest.Open()
>
> sSelect = "select name from sysadm.systables where name not like 'SYS%' "
>
> Dim Cmd As New Odbc.OdbcCommand(sSelect, hQuest)
>
> da.SelectCommand = Cmd
>
> Dim ds As DataSet = New DataSet
>
> da.Fill(ds)
>
> lbTable.DataSource = ds.Tables(0)
>
> hQuest.Close()
>
> What's wrong? Is it the data adapter or the data set?
>
>
>
>
>
>
>
>
>
>
Author
25 Jan 2006 2:24 PM
Peter Lux
"Kerry Moorman" <KerryMoor***@discussions.microsoft.com> wrote in message
>
> Try assigning a column name from the table to the listbox's DisplayMember
> property. For example:
>
> lbTable.DisplayMember = "TableName"
>

Thanks, that did it. Why should you have to do this, though?
Author
26 Jan 2006 3:09 AM
Peter Huang" [MSFT]
Hi

I think that would tell which property of the listbox to bind for the
datasource.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.