% DIM mySQL, str_Art, str_Year, str_Namn, str_Plats, str_sok1, str_sok2, str_sok3, str_urval, Date_Start, Date_Stop, mySQL2,strUrval2 DIM str_fotoparameters, strFotoDate DIM counter str_Art = Request.Form("Art") str_Year = Request.Form("Year") str_Namn = Request.Form("Namn") str_Plats = Request.Form("Plats") str_sok1 = Request.Form("sok1") str_sok2 = Request.Form("sok2") str_sok3 = Request.Form("sok3") If str_Art = "---Art---" then str_Art = "" end if If str_Year = "---År---" then str_Year = "" end if If str_sok1 = "" then str_sok1 = "t1.art" str_sok2 = "t1.vikt DESC" str_sok3 = "t1.datum DESC" else str_sok1 = "t1." & str_sok1 str_sok2 = "t1." & str_sok2 str_sok3 = "t1." & str_sok3 end if If str_Art & str_Year & str_Namn & str_Plats = "" then str_urval = "t1.art= ''" else If str_Art <> "" then str_urval = "t1.art= '" & str_Art & "'" If str_Namn <> "" then str_urval = str_urval & " AND t1.namn LIKE '%" & str_Namn & "%'" end if If str_Year <> "" then Date_Start = "'" & str_Year & "0101'" Date_Stop = "'" & str_Year & "1231'" str_urval = str_urval & " AND t1.datum BETWEEN " & Date_Start & " AND " & Date_Stop end if If str_Plats <> "" then str_urval = str_urval & " AND t1.plats LIKE '%" & str_Plats & "%'" end if If Request.Form("Poang") <> "" then str_urval = str_urval & " AND t1.poang > 0" end if else If str_Namn <> "" then str_urval = "t1.namn LIKE '%" & str_Namn & "%'" If str_Year <> "" then Date_Start = "'" & str_Year & "0101'" Date_Stop = "'" & str_Year & "1231'" str_urval = str_urval & " AND t1.datum BETWEEN " & Date_Start & " AND " & Date_Stop end if If str_Plats <> "" then str_urval = str_urval & "AND t1.plats LIKE '%" & str_Plats & "%'" end if If Request.Form("Poang") <> "" then str_urval = str_urval & " AND t1.poang > 0" end if else If str_Year <> "" then Date_Start = "'" & str_Year & "0101'" Date_Stop = "'" & str_Year & "1231'" str_urval = "t1.datum BETWEEN " & Date_Start & " AND " & Date_Stop If str_Plats <> "" then str_urval = str_urval & " AND plats LIKE '%" & str_Plats & "%'" end if If Request.Form("Poang") <> "" then str_urval = str_urval & " AND t1.poang > 0" end if else If str_Plats <> "" then str_urval = "t1.plats LIKE '%" & str_Plats & "%'" If Request.Form("Poang") <> "" then str_urval = str_urval & " AND t1.poang > 0" end if end if end if end if end if end if mySQL = "SELECT Art, Vikt, Metod, Bete, Plats, Kommun, Namn, Datum, Poang FROM fisk where " & str_urval & " ORDER BY " & str_sok1 & ", " & str_sok2 & ", " & str_sok3 & ";" mySQL = "SELECT Art, Vikt, Metod, Bete, Plats, Kommun, Namn, Datum, Poang, Foto FROM fisk where " & str_urval & " ORDER BY " & str_sok1 & ", " & str_sok2 & ", " & str_sok3 & ";" ' Ny tabell 'str_urval = str_urval & " AND t1.nr = t2.nr" 'str_urval = "t2.foto <> ''" 'If str_Art & str_Year & str_Namn & str_Plats = "" then ' str_urval = "t1.art= ''" 'end if mySQL = "SELECT t1.Art, t1.Vikt, t1.Metod, t1.Bete, t1.Plats, t1.Kommun, t1.Namn, t1.Datum, t1.Poang, t2.Foto FROM fisk AS t1 LEFT JOIN foto AS t2 ON t1.Nr=t2.Nr where " & str_urval & " ORDER BY " & str_sok1 & ", " & str_sok2 & ", " & str_sok3 & ";" DIM objRS Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open mySQL, objConn str_urval2 = Replace(str_urval,"t1.","") str_urval2 = Replace(str_urval2,"t2.","") mySQL2 = "SELECT Art, Count(Art), Avg(Vikt) FROM fisk where " & str_urval2 & " GROUP BY Art;" DIM objRS2 Set objRS2 = Server.CreateObject("ADODB.Recordset") objRS2.Open mySQL2, objConn %>
| Art | Vikt | Metod | Bete | Plats | Ort | Namn | Datum | |
| <% Response.Write objRS("Art") %> | <% Response.Write objRS("Vikt") %> | <% Response.Write objRS("Metod") %> | <% Response.Write objRS("Bete") %> | <% Response.Write objRS("Plats") %> | <% Response.Write objRS("Kommun") %> | <% Response.Write objRS("Namn") %> | <% Response.Write strSwedDate %> | <% IF objRS("Foto") <> "" then 'IF objRS("Vikt") > "2000" then strFotoDate = ConvDate(strOrgDate, "%Y") & "-" & ConvDate(strOrgDate, "%m") & "-" & ConvDate(strOrgDate, "%d") str_fotoparameters = "Foto=" & objRS("Foto") & "&Art=" & objRS("Art") & "&Datum=" & strFotoDate & "&Vikt=" & objRS("Vikt") 'str_fotoparameters = "Foto=" & "2006-12-16 Gadda 13300.jpg" & "&Art=" & objRS("Art") & "&Datum=" & strFotoDate & "&Vikt=" & objRS("Vikt") %> F <% end IF %> |