<form method="post" action="hem.asp"> Detta kanske kan var till hjälp:Hur gör man???
<%
strort = request.form("auk")
set contab= server.createObject("ADODB.connection")
contab.open "europadb3"
sql = "SELECT * FROM auktion "
Set rs = contab.Execute(sql,,1)%>
<%
set conbud= server.createObject("ADODB.connection")
conbud.open "europadb3"%>
<%SQL2="SELECT * FROM bud WHERE (bud.Auktionid =" & rs("auktionsid")& ") order by bud desc "%>
<%Set rs2 = conbud.Execute(sql2,,1)%>
<%Session("aukid") = CInt(rs("Auktionsid"))%>
<%
response.write"<TABLE border='1'>"
Response.write("<tr>")
Response.write ( "<td><font face=""standard"" size=""5"" color=""#000099"">" & ("Datum")& vbCrLf & "</font></td>")
Response.write ( "<td><font face=""standard"" size=""5"" color=""#000099"">" & ("Namn")& vbCrLf & "</font></td>")
Response.write ( "<td><font face=""standard"" size=""5"" color=""#000099"">" & ("Ort")& vbCrLf & "</font></td>")
Response.write ( "<td><font face=""standard"" size=""5"" color=""#000099"">" & ("Budnivå")& vbCrLf & "</font></td>")
Response.write ( "<td><font face=""standard"" size=""5"" color=""#000099"">" & ("Värde")& vbCrLf & "</font></td>")
Response.write ( "<td><font face=""standard"" size=""5"" color=""#000099"">" & ("Sluttid")& vbCrLf & "</font></td>")
Response.write ( "<td><font face=""standard"" size=""5"" color=""#000099"">" & ("Bjud")& vbCrLf & "</font></td>")
Response.write("</tr>")
do while not rs2.EOF
do while not rs.eof
Response.write("<tr>")
Response.write( "<td>" & rs("kursdatum")& " " & "</td>")
Response.write( "<td>" & rs("kursnamn")& " " & "</td>")
Response.write( "<td>" & rs("kursort")& " " & "</td>")
Response.write( "<td>" & rs2("bud")& " " & "</td>")
Response.write( "<td>" & rs("varde")& " " & "</td>")
Response.write ( "<td>" & rs("slut")& " " & "</td>")
Response.Write "<td>Bjud</td>"
Response.write("</tr>")
rs.movenext()
Loop
rs2.MoveNext()
Loop
%> <%
contab.Close
Set contab = Nothing
conbud.close
set conbud = nothing
%>
Det ska bli en auktion av det hela....
MEN jag har ett STORT problem och det är att få rätt data med mig till bjud sidan...oavsett vilken auktion jag försöker bjuda på tar den samma idnummer med sig och jag vet att problemet ligger i SQL frågan och gissar att vad jag behöver är en subquery....men får inte till någon sådan...är det någon vänlig själ som kan hjälpa mig att få till det??
tabellerna heter auktion med fälten auktionsid,kursdatum,kursnamn,kurslangd,kursort,kursid,varde,slut
och Bud med fälten budid,bud,auktionid,anvandarid
;)
så här ser det ut nu!
http://www.europaformedlaren.com/auktion/hem.aspSv: Hur gör man???
<code>
<%
strort = request.form("auk")
set con= server.createObject("ADODB.connection")
con.open "europadb3"
strSQL = "SELECT auktion.*, (SELECT Max(bud)" & vbCrLf & _
" FROM bud" & vbCrLf & _
" WHERE bud.Auktionid = auktion.auktionsid) As MaxBud" & vbCrLf & _
"FROM auktion"
Set rs = con.Execute(sql)
Response.write "<TABLE border='1'>"
Response.write "<tr>"
Response.write "<td><font face=""standard"" size=""5"" color=""#000099"">" & "Datum" & vbCrLf & "</font></td>"
Response.write "<td><font face=""standard"" size=""5"" color=""#000099"">" & "Namn" & vbCrLf & "</font></td>"
Response.write "<td><font face=""standard"" size=""5"" color=""#000099"">" & "Ort" & vbCrLf & "</font></td>"
Response.write "<td><font face=""standard"" size=""5"" color=""#000099"">" & "Budnivå" & vbCrLf & "</font></td>"
Response.write "<td><font face=""standard"" size=""5"" color=""#000099"">" & "Värde" & vbCrLf & "</font></td>"
Response.write "<td><font face=""standard"" size=""5"" color=""#000099"">" & "Sluttid" & vbCrLf & "</font></td>"
Response.write "<td><font face=""standard"" size=""5"" color=""#000099"">" & "Bjud" & vbCrLf & "</font></td>"
Response.write "</tr>"
Do Until rs.eof
Response.write "<tr>"
Response.write "<td>" & rs("kursdatum") & " " & "</td>"
Response.write "<td>" & rs("kursnamn") & " " & "</td>"
Response.write "<td>" & rs("kursort") & " " & "</td>"
Response.write "<td>" & rs("MaxBud") & " " & "</td>"
Response.write "<td>" & rs("varde") & " " & "</td>"
Response.write "<td>" & rs("slut") & " " & "</td>"
Response.Write "<td>Bjud</td>"
Response.write "</tr>"
rs.movenext()
Loop
con.Close
Set con = Nothing
%>
</code>