title image


Smiley Re: das ist sicher kein System.Windows.Forms.TreeView
Habe mal das probiert:



try

{

SqlConnection connect = new SqlConnection(connStr);

SqlCommand cmd = connect.CreateCommand();

cmd.CommandText = "Select Distinct Sites.PortalName From Docs Cross Join Sites";

connect.Open();

SqlDataReader reader = cmd.ExecuteReader();

TreeNode root = new TreeNode();

while (reader.Read())

{

root.Text = reader["PortalName"].ToString();

root.ImageUrl = "/_layouts/images/sphomesm.gif";

//tree.Nodes.Add(new TreeNode(reader["PortalName"].ToString()));

tree.Nodes.Add(root);

}

connect.Close();

foreach (TreeNode node in tree.Nodes)

{

cmd.CommandText = "Select Distinct Webs.Title from Docs Cross Join Webs Cross Join Sites Where Sites.PortalName = '" + node.Text + "'";

connect.Open();

reader = cmd.ExecuteReader();

TreeNode child = new TreeNode();

while (reader.Read())

{

if (reader["Title"] != System.DBNull.Value)

{

child.Text = reader["Title"].ToString();

tree.Nodes.Add(child);

//node.Nodes.Add(new TreeNode(reader["Title"].ToString()));

}

}

connect.Close();

}

}

catch (Exception e)

{

lbErr.Text = e.Message.ToString();

}



Ergebnis: Keine Fehler, nichts wird angezeigt!! :-((((



Gruß Andi

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: