<% 'ö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 'hämta alla nyheter SQL1 = "SELECT * From table1 WHERE theType='news' ORDER BY theDate DESC" Databas.Execute( SQL1 ) set RecSet=Databas.execute(SQL1) if RecSet.EOF then response.write "

Inga nyheter ännu

" end if %> RSS-flöde Nyheterna som RSS-feed

Nyheter

<% huvudPic = RecSet("thePic") theOtherPic = RecSet("theOtherPic") Do Until RecSet.EOF response.write "

" & textfix(RecSet("theHead")) & "

" response.write textfix(left(RecSet("theText"),80)) response.write "...
Läs mer | " & left(RecSet("theDate"),11) &"

" RecSet.MoveNext Loop RecSet.Close set RecSet = nothing %>
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 %>