22. marts 2002 - 19:26Der er
16 kommentarer og 1 løsning
Tabel menu
Jeg har en menu som henter data fra en .mdb den ser sådan ud:
1 2 3 1,1 2,1 3,1 1,2 2,2 3,2 1,3 2,3 3,3
Men jeg vil have det hele i en kolonne
1 1,1 1,2 1,3 2 2,1 2,2 2,3
koden ser sådan ud:
<% Response.Buffer = false
sql = "select * from tbloverskrift where aktiv = true" rs.open sql, conn dim varTemp() dim intCount Response.Write "<center><table border=0 cellspacing=0>" Response.Write "<tr>" do while not rs.eof
Skal virksomheder stå stærkere mod angreb og kunne udvikle sig, skal sikkerhed, drift og forretning tænkes sammen. Det er tanken bag Jysk IT’s ambition om at skabe en “sikker fremtid” for kunderne.
hi txk>I am not too hot on ASP but have had a look at the demo and the database. As far as I can see it is only possible to have "hovedpunkter" and "underpunkter", you can NOT have "underpunkter" to "underpunkter. The example I gave in http://exp.dk/spm/188486 can be done with one single table but it requires coding a recursive function. A recursive function is one whích calls itsself while it traverses down the menu structure.
txk> I know how to read your the data from the database in the correct order but as I said, I am not HOT on ASP (HTML) so I cant say how your code is will be. I CAN SAY though that you will need two recordsets, one for the main menu's "hovedpunkter" and one for the sub menues "underpunkter". If you can alter the HTML the I can explain how to read the dB.
I have modified the code so as to read the database in the correct order (NOTE: There are two recordsets so the new one needs DIM'ing)
The HTML will more than likely be wrong, so you can see igf you can get that coorect!
Jeg er ikke god til ASP, men hvis ikke andre vil, så kommer jeg med et forslag.
Du skal have 2 recordset: sqlHvdPkt = "select * from tbloverskrift where aktiv = true" rsHvdPkt.open sql, conn og sqlUndPkt = "select * from tblmpunkt" rsUndPkt.open sql, conn
Så skal du køre nogle loops:
do while not rsHvdPkt.eof ASP.Skriv.enlinje = rshvdpkt("overskrift") rsUndPkt.movefirst do while not rsUndPkt.eof if rsUndPkt("fk_overskrift") = rshvdPkt("ID") then ASP.Skriv.enlinje = rsUndpkt("URL") end if rsUndPkt.movenext loop rshvdPkt.movenext loop
Hi niels>Well actuallyy I have done a bit with it but it isnt in the finger tips like Access and VB so I have to test everyting to make sure that its correct and it takes far too long!
No! I have only altered the code to read the database, you need to ensure that the HTML is correct! So there is some work needed from you before it will work.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.