<% 'öppna databasen Set Databas = Server.CreateObject( "Adodb.Connection" ) Databas.Provider = "Microsoft.Jet.OLEDB.4.0" MdbFilePath = Server.MapPath("db\theDB.mdb") Databas.ConnectionString = "Data Source='" & MdbFilePath & "'" Databas.open %>
<% 'kolla om det är någon av undersidorna som hämtas if request.querystring("subID") > "" then 'hämta ev undermeny SQL = "SELECT * From table1 WHERE theType='submenu' AND menuID=" & Request.Querystring("subID") &" " Databas.Execute( SQL ) set RecSet=Databas.execute(SQL) if RecSet.EOF then response.write "" end if Do Until RecSet.EOF response.write ""& RecSet("theHead") &"    " RecSet.MoveNext Loop RecSet.Close Set RecSet = nothing else Response.write "" end if %>
<% dim huvudPic dim theOtherPic 'kolla om det är någon av undersidorna som hämtas if request.querystring("id") > "" then SQL = "SELECT * From table1 WHERE theID = " & Request.Querystring("id") &"" Databas.Execute( SQL ) set RecSet=Databas.execute(SQL) 'response.write "

" 'response.write textfix(RecSet("theHead")) 'response.write "

" response.write textfix(RecSet("theText")) response.write "
" & left(RecSet("theDate"),11) &"" huvudPic = RecSet("thePic") theOtherPic = RecSet("theOtherPic") RecSet.Close Set RecSet = nothing 'annars hämta startsidan else SQL = "SELECT * From table1 WHERE theID = " & 1 & " ORDER BY theDate DESC" Databas.Execute( SQL ) set RecSet=Databas.execute(SQL) 'response.write "

" 'response.write textfix(RecSet("theHead")) 'response.write "

" response.write textfix(RecSet("theText")) response.write "
" & left(RecSet("theDate"),11) &"" huvudPic = RecSet("thePic") theOtherPic = RecSet("theOtherPic") RecSet.Close Set RecSet = nothing end if %>
LRF Agria Sleipner Krafft
<% SQL = "SELECT TOP 4 * From table1 WHERE theType = 'news' ORDER BY theDate DESC" Databas.Execute( SQL ) set RecSet=Databas.execute(SQL) Do Until RecSet.EOF if RecSet.EOF then response.write "Inga nyheter än" end if response.write textfix(RecSet("theHead")) response.write "
" & left(RecSet("theDate"),11) &" | Läs mer

" RecSet.MoveNext Loop RecSet.Close Set RecSet = nothing %>
<% Databas.Close set Databas = nothing 'stänger databasen för hela sidan %>