- Home
- Categorie
- Coding e Sistemistica
- Altri linguaggi per il web
- Select dentro select
-
Select dentro select
Con questo codice:
'---INIZIO RECUPERA DATI IN CICLO DAL DATABASE------------ strDataBasePath = "\mdb-database\database.mdb" connDATI = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strDataBasePath) & ";" & "JET OLEDB:Database Password=paperino" viewuserSQL = "SELECT * FROM DocumentiUt" 'E creo il recordset Set recDATI = Server.CreateObject ("ADODB.Recordset") recDATI.Open viewuserSQL, connDATI, 3, 3 'Creo il Documento XML xmlContent = "<?xml version=""1.0"" encoding=""UTF-8""?>"&VbCrLf xmlContent = xmlContent & "<gallery>"&VbCrLf xmlContent = xmlContent & "<album lgPath=""/"" tnPath=""/"" title=""Porsche"" description=""Album description"" tn=""album1/thumb/1.jpg"">"&VbCrLf while not recDATI.eof testo=recDATI("testo") PercorsoImg1=recDATI("PercorsoImg1") xmlContent = xmlContent & "<img src=""" & PercorsoImg1 & """ title="""" caption="""&testo&""" link="""&PercorsoImg1&""" target=""_blank"" pause="""" />"&VbCrLf recDATI.movenext wend xmlContent = xmlContent & "</album>"&VbCrLf xmlContent = xmlContent & "</gallery>" 'Fine Creazione XML ```creo il seguente file xml:
<?xml version="1.0" encoding="UTF-8"?>
<gallery><album lgPath="/" tnPath="/" title="Dicembre" description="" tn="/AutoSystem/album1/images/1.jpg">
<img src="/AutoSystem/album1/images/1.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/1.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album1/images/2.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/2.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album1/images/3.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/3.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album1/images/4.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/4.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album1/images/5.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/5.jpg" target="_blank" pause="" />
</album></gallery>
<?xml version="1.0" encoding="UTF-8"?>
<gallery><album lgPath="/" tnPath="/" title="Dicembre" description="" tn="/AutoSystem/album1/images/1.jpg">
<img src="/AutoSystem/album1/images/1.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/1.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album1/images/2.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/2.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album1/images/3.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/3.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album1/images/4.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/4.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album1/images/5.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album1/images/5.jpg" target="_blank" pause="" />
</album><album lgPath="/" tnPath="/" title="Novembre" description="" tn="/AutoSystem/album2/images/1.jpg">
<img src="/AutoSystem/album2/images/1.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album2/images/1.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album2/images/2.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album2/images/2.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album2/images/3.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album2/images/3.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album2/images/4.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album2/images/4.jpg" target="_blank" pause="" />
<img src="/AutoSystem/album2/images/5.jpg" title="" caption="DESCRIZIONE" link="/AutoSystem/album2/images/5.jpg" target="_blank" pause="" />
</album></gallery>
devo per caso fare una select dentro un'altra select?
-
Sto facendo qualche passo in avanti ma ancora non ci sono, mi manca un ultima cosa...
con questo codice (select nella select):
'---INIZIO RECUPERA DATI IN CICLO DAL DATABASE------------ strDataBasePath = "\mdb-database\database.mdb" connDATI = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strDataBasePath) & ";" & "JET OLEDB:Database Password=paperino" viewuserSQL = "SELECT * FROM DocumentiUt" 'SQL2 viewuserSQL2 = "SELECT album FROM DocumentiUt group by album" 'E creo il recordset Set recDATI = Server.CreateObject ("ADODB.Recordset") recDATI.Open viewuserSQL, connDATI, 3, 3 'E creo il recordset2 Set recDATI2 = Server.CreateObject ("ADODB.Recordset") recDATI2.Open viewuserSQL2, connDATI, 3, 3 'Creo il Documento XML xmlContent = "<?xml version=""1.0"" encoding=""UTF-8""?>"&VbCrLf xmlContent = xmlContent & "<gallery>"&VbCrLf while not recDATI2.eof album=recDATI2("album") xmlContent = xmlContent & "<album lgPath=""/"" tnPath=""/"" title=""Porsche"" description="""&album&""" tn=""album1/thumb/1.jpg"">"&VbCrLf while not recDATI.eof testo=recDATI("testo") PercorsoImg1=recDATI("PercorsoImg1") xmlContent = xmlContent & "<img src=""" & PercorsoImg1 & """ title="""" caption="""&testo&""" link="""&PercorsoImg1&""" target=""_blank"" pause="""" />"&VbCrLf recDATI.movenext wend xmlContent = xmlContent & "</album>"&VbCrLf recDATI2.movenext wend xmlContent = xmlContent & "</gallery>" 'Fine Creazione XML
riesco ad avere tutti gli album ma solo il primo esce popolato (e con tutti gli elementi, anche quelli di altri album)
<?xml version="1.0" encoding="UTF-8"?> <gallery> <album lgPath="/" tnPath="/" title="Porsche" description="album1" tn="album1/thumb/1.jpg"> <img src="/album1/images/6485_bg.jpg" title="" caption="GIGGIG" link="/album1/images/6485_bg.jpg" target="_blank" pause="" /> <img src="/album1/images/4979_photo_stripes.png" title="" caption="APPAPPAPPA" link="/public/album1/images/4979_photo_stripes.png" target="_blank" pause="" /> <img src="/album2/images/4979_photo_stripes.png" title="" caption="fghfg" link="" target="_blank" pause="" /> <img src="/album4/images/4979_photo_stripes.png" title="" caption="rtryrtryrt" link="" target="_blank" pause="" /> </album> <album lgPath="/" tnPath="/" title="Porsche" description="album2" tn="album1/thumb/1.jpg"> </album> <album lgPath="/" tnPath="/" title="Porsche" description="album4" tn="album1/thumb/1.jpg"> </album> </gallery>