<% 'ö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 'hämta nyheten SQL1 = "SELECT * From table1 WHERE theID=" & Request.Querystring("id") &" " Databas.Execute( SQL1 ) set RecSet=Databas.execute(SQL1) if RecSet.EOF then response.write "

Ogiltigt id

" end if huvudPic = RecSet("thePic") theOtherPic = RecSet("theOtherPic") response.write "

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

" response.write textfix(RecSet("theText")) response.write "
" & left(RecSet("theDate"),11) &"

" RecSet.Close set RecSet = nothing %> Tillbaka till nyheterna
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 %>