J'ai essayé d'inclure ton code sur ma page d'accès aux données (SQL/Server). Cela ne fonctionne pas car il ne reconnaît pas "response".
J'ai modifié le code à sa plus siple expression par response.write tvw_Categories,...." en code dur sans faire référence aux champs de la base de données cela ne fonctionne pas mieux.
Peux-tu m'aider à inclure le code nécessaire par rapport à mon code existant ? Le tableaux de deux colonnes et une ligne contient un treeview et un tableau d'accès aux données. Ce dernier m'indique que la connexion se fait correctement et sera supprimer ensuite (après fonctionnement du TVW.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="fr">
<title>Page Produits UNTEL</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Theme" content="tabs 1111, default">
<meta name="Microsoft Border" content="tlb, default">
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1">
<tr>
<td width="50%" valign="top">
<object classid="clsid:C74190B6-8589-11D1-B16A-00C0F0283628" id="Tvw_Categories" width="346" height="583">
<param name="_ExtentX" value="9155">
<param name="_ExtentY" value="15425">
<param name="_Version" value="393217">
<param name="HideSelection" value="1">
<param name="Indentation" value="1000">
<param name="LabelEdit" value="0">
<param name="LineStyle" value="0">
<param name="PathSeparator" value="\">
<param name="Sorted" value="0">
<param name="Style" value="7">
<param name="Checkboxes" value="0">
<param name="FullRowSelect" value="0">
<param name="HotTracking" value="1">
<param name="Scroll" value="1">
<param name="SingleSel" value="1">
<param name="ImageList" value="Iml_Treeviews">
<param name="BorderStyle" value="1">
<param name="Appearance" value="1">
<param name="MousePointer" value="99">
<param name="Enabled" value="1">
<param name="OLEDragMode" value="0">
<param name="OLEDropMode" value="0">
</object>
</td>
<td width="50%" valign="top">
<table width="100%" border="1">
<thead>
<tr>
<td valign="top"><b>fld_CategoryID</b></td>
<td><b>fld_CategoryParentID</b></td>
<td><b>fld_CategoryName</b></td>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames="fld_CategoryID,fld_CategoryParentID,fld_CategoryName" s-columntypes="72,129,129" s-dataconnection="JPG" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice="fld_CategoryID" s-menuvalue="fld_CategoryID" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="TRUE" s-recordsource="tbl_Categories" s-displaycolumns="fld_CategoryID,fld_CategoryParentID,fld_CategoryName" s-criteria s-order s-sql="SELECT * FROM tbl_Categories" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="Aucun enregistrement renvoyé." i-maxrecords="256" i-groupsize="5" botid="0" u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc" u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" align="left" width="100%"><font color="#000000">Début d'une requête de résultats de base de données.</font></td></tr>" startspan b-WasTableFormat="TRUE" --><!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>Le composant Résultats de base de données de cette page n'est pas en mesure d'afficher le contenu de la base de données. Le nom du fichier de la page doit se terminer par « .asp » et le site Web doit être hébergé sur un serveur qui prend en charge les pages ASP.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM tbl_Categories"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=3 align=left width=""100%"">Aucun enregistrement renvoyé.</td></tr>"
fp_sDataConn="JPG"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=5
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="fld_CategoryID"
fp_sMenuValue="fld_CategoryID"
fp_iDisplayCols=3
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-CheckSum="12901" --><tr>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="fld_CategoryID,fld_CategoryParentID,fld_CategoryName" s-column="fld_CategoryID" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>fld_CategoryID<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"fld_CategoryID")%><!--webbot bot="DatabaseResultColumn" endspan i-CheckSum="44067" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="fld_CategoryID,fld_CategoryParentID,fld_CategoryName" s-column="fld_CategoryParentID" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>fld_CategoryParentID<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"fld_CategoryParentID")%><!--webbot bot="DatabaseResultColumn" endspan i-CheckSum="62360" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="fld_CategoryID,fld_CategoryParentID,fld_CategoryName" s-column="fld_CategoryName" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>fld_CategoryName<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"fld_CategoryName")%><!--webbot bot="DatabaseResultColumn" endspan i-CheckSum="44720" --></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="5" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" align="left" width="100%"><font color="#000000">Fin d'une requête de résultats de base de données.</font></td></tr><TR><TD ALIGN=LEFT VALIGN=MIDDLE COLSPAN=64><NOBR><INPUT TYPE=Button VALUE=" |< "><INPUT TYPE=Button VALUE=" < "><INPUT TYPE=Button VALUE=" > "><INPUT TYPE=Button VALUE=" >| "> [1/5]</NOBR><BR></td></tr>" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-CheckSum="62730" --></tbody>
</table>
</td>
</tr>
</table>
<dl>
<dd>
<p> </p>
</dd>
</dl>
</body>
</html>
Patrick
patrick.toledano@laposte.fr
-------------------------------
Réponse au message :
-------------------------------
> voici un exemple de code
> si tu veux plus d'explication n'hésite pas à me demander
>
> <HTML>
> <HEAD>
> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
> <TITLE></TITLE>
> </HEAD>
> <BODY topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" bgcolor="C0C0C0">
> <OBJECT id=TreeView1 style="WIDTH: 190px; HEIGHT: 700px" classid=clsid:C74190B6-8589-11D1-B16A-00C0F0283628 VIEWASTEXT>
> <PARAM NAME="_ExtentX" VALUE="4260">
> <PARAM NAME="_ExtentY" VALUE="15399">
> <PARAM NAME="_Version" VALUE="393217">
> <PARAM NAME="HideSelection" VALUE="1">
> <PARAM NAME="Indentation" VALUE="529">
> <PARAM NAME="LabelEdit" VALUE="1">
> <PARAM NAME="LineStyle" VALUE="1">
> <PARAM NAME="PathSeparator" VALUE="\">
> <PARAM NAME="Sorted" VALUE="0">
> <PARAM NAME="Style" VALUE="7">
> <PARAM NAME="Checkboxes" VALUE="0">
> <PARAM NAME="FullRowSelect" VALUE="0">
> <PARAM NAME="HotTracking" VALUE="0">
> <PARAM NAME="Scroll" VALUE="1">
> <PARAM NAME="SingleSel" VALUE="0">
> <PARAM NAME="ImageList" VALUE="">
> <PARAM NAME="BorderStyle" VALUE="0">
> <PARAM NAME="Appearance" VALUE="1">
> <PARAM NAME="MousePointer" VALUE="0">
> <PARAM NAME="Enabled" VALUE="1">
> <PARAM NAME="OLEDragMode" VALUE="0">
> <PARAM NAME="OLEDropMode" VALUE="0">
> </OBJECT>
> <OBJECT id=ImageList1 classid=clsid:2C247F23-8591-11D1-B16A-00C0F0283628 VIEWASTEXT>
> <PARAM NAME="_ExtentX" VALUE="1005">
> <PARAM NAME="_ExtentY" VALUE="1005">
> <PARAM NAME="BackColor" VALUE="-2147483643">
> <PARAM NAME="ImageWidth" VALUE="0">
> <PARAM NAME="ImageHeight" VALUE="0">
> <PARAM NAME="MaskColor" VALUE="12632256">
> <PARAM NAME="UseMaskColor" VALUE="-1">
> <PARAM NAME="_Version" VALUE="327682">
> </OBJECT>
> <SCRIPT LANGUAGE="VBScript">
> TreeView1.Font.Name = "Arial"
> TreeView1.Font.Size = 7
> ImageList1.ListImages.Add 1,"Site",loadpicture("D:\temp\site.gif")
> ImageList1.ListImages.Add 2,"Batiment",loadpicture("D:\temp\batiment.gif")
> ImageList1.ListImages.Add 3,"Etage",loadpicture("D:\temp\etage.gif")
> ImageList1.ListImages.Add 4,"Local",loadpicture("D:\temp\local.gif")
> set TreeView1.ImageList = ImageList1
> <%
>
> 'ImageList1.ListImages.Add 1,"Site",loadpicture("D:\temp\site.gif")
>
> 'set TreeView1.ImageList = ImageList1
> 'Ouverture d'une connexion à la base de données
> Dim Connect
> Dim ConnectDBQ
>
> Set Connect = Server.CreateObject("ADODB.Connection")
> connect.Provider="MSDataShape"
> ConnectDBQ="DRIVER={Microsoft Access Driver (*.mdb)};"&"DBQ=E:\www\ocp\basedonnees\Ocp.mdb;"
> Connect.Open ConnectDBQ
>
> 'Création de la variable de l'instruction SQL
> Dim strSQL
> strSQL = "SHAPE {select [sit_N°],sit_Libelle from site ORDER BY sit_Libelle} " & _
> "APPEND ((SHAPE {select [bat_N°], [bat_N°Site], bat_Libelle from Batiment ORDER BY bat_Libelle} " & _
> "APPEND ((SHAPE {SELECT [eta_N°],eta_code,[eta_N°batiment] FROM Etage ORDER BY eta_Code} " & _
> "APPEND ({SELECT [loc_N°],loc_code,[loc_N°etage] FROM locaux ORDER BY loc_Code} AS DataLocaux RELATE [eta_N°] TO [loc_N°etage])) AS DataEtage RELATE [bat_N°] TO [eta_N°Batiment])) as DataBatiment RELATE [sit_N°] TO [bat_N°Site])"
>
> 'Création d'une instance de l'objet Recordset
> Dim ObjRS, ObjRS2, ObjRS3, ObjRS4
> Set ObjRS = Server.CreateObject("ADODB.Recordset")
> ObjRS.Open strSQL, Connect
>
> Dim cleSite,cleBatiment,cleEtage,cleLocal
>
> 'Affichage dans le treeview
> While Not ObjRS.EOF
> Set ObjRS2 = ObjRS.Fields("DataBatiment").Value
> cleSite = "s-" & ObjRS.Fields("sit_N°")
> response.write "TreeView1.Nodes.Add ,,""" & cleSite & """,""" & ObjRS.Fields("sit_Libelle") & """,""Site""" & chr(10)
> While Not ObjRS2.EOF
> Set ObjRS3 = ObjRS2.Fields("DataEtage").Value
> cleBatiment = "b-" & ObjRS2.Fields("bat_N°")
> response.write "TreeView1.Nodes.Add """ & cleSite & """, 4,""" & cleBatiment & """,""" & ObjRS2.Fields("bat_Libelle") & """,""Batiment""" & chr(10)
> While Not ObjRS3.EOF
> Set ObjRS4 = ObjRS3.Fields("Datalocaux").Value
> cleEtage = "e-" & ObjRS3.Fields("eta_N°")
> response.write "TreeView1.Nodes.Add """ & cleBatiment & """, 4,""" & cleEtage & """,""" & ObjRS3.Fields("eta_Code") & """,""Etage""" & chr(10)
> While Not ObjRS4.EOF
> cleLocal = "l-" & ObjRS4.Fields("loc_N°")
> response.write "TreeView1.Nodes.Add """ & cleEtage & """, 4,""" & cleLocal & """,""" & ObjRS4.Fields("loc_Code") & """,""Local""" & chr(10)
> ObjRS4.MoveNext
> wend
> ObjRS3.MoveNext
> wend
> ObjRS2.MoveNext
> wend
> ObjRS.MoveNext
> wend
>
>
> ObjRS.Close
> Set ObjRS = Nothing
> Connect.Close
> set Connect = Nothing
>
>
> %>
> sub Treeview1_NodeClick(ByVal Node)
> msgbox node.key
> select case mid(Node.Key,1,1)
> case "s"
> window.parent.frames(1).location.href="../cadmanager/site.asp?num_sit=" & mid(Node.Key,3)
> case "b"
> window.parent.frames(1).location.href="../cadmanager/batiment.asp?num_bat=" & mid(Node.Key,3)
> case "e"
> window.parent.frames(1).location.href="../cadmanager/etage.asp?num_eta=" & mid(Node.Key,3)
> case "l"
> window.parent.frames(1).location.href="../cadmanager/local.asp?num_loc=" & mid(Node.Key,3)
> end select
> end sub
>
> </SCRIPT>
>
> </BODY>
> </HTML>
>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> Salut,
> qui aurait un exemple de page avec implémentation du TreeView livré avec Visual Studio ?
>
> D'avance merci
>