Home All Groups Group Topic Archive Search About

TreeView Populating problem

Author
20 Jan 2006 3:56 PM
JN
Hi All,

I am using an SqldataAdapter to fill a dataset table:

Dim dadEmployees As SqlDataAdapter = New _
          SqlDataAdapter("SELECT FirstName + ' ' + LastName AS FullName
Employees", con)
         Dim dst As DataSet = New DataSet()
          dadEmployees.Fill(dst, "tbEmployees")


Now I want to use the FullName Field to populate the TreeView:

Sub PopulateNodes()
        Dim dst As DataSet = GetTreeViewData() ' Function returns the filled
dataset
        For Each masterRow As DataRow In dst.Tables("tbEmployees").Rows
            Dim masterNode As New _
              TreeNode(masterRow("FullName").ToString.ToUpper)

I get this error:

Column 'FullName' does not belong to table tbEmployees.

I create a gridview and set the datasource to the dataset and it populate
the FullName fields so how come I am not able to look it up using the
treeview?

Thanks.
JN

Author
20 Jan 2006 4:17 PM
JN
Nevermind, syntax error

Show quote
"JN" <jnsi***@rogers.com> wrote in message
news:u5xNdpdHGHA.648@TK2MSFTNGP14.phx.gbl...
> Hi All,
>
> I am using an SqldataAdapter to fill a dataset table:
>
> Dim dadEmployees As SqlDataAdapter = New _
>          SqlDataAdapter("SELECT FirstName + ' ' + LastName AS FullName
> Employees", con)
>         Dim dst As DataSet = New DataSet()
>          dadEmployees.Fill(dst, "tbEmployees")
>
>
> Now I want to use the FullName Field to populate the TreeView:
>
> Sub PopulateNodes()
>        Dim dst As DataSet = GetTreeViewData() ' Function returns the
> filled dataset
>        For Each masterRow As DataRow In dst.Tables("tbEmployees").Rows
>            Dim masterNode As New _
>              TreeNode(masterRow("FullName").ToString.ToUpper)
>
> I get this error:
>
> Column 'FullName' does not belong to table tbEmployees.
>
> I create a gridview and set the datasource to the dataset and it populate
> the FullName fields so how come I am not able to look it up using the
> treeview?
>
> Thanks.
> JN
>
>
>
>
>

AddThis Social Bookmark Button