<% ' Start ASP code here before the HTML. Its always better to do as much ASP stuff before any output. ' First of all, include a simple file which contains some variable values. %> <% ' Now some values have been set we can use them to connect to the Access database ' First, build a SQL query to get the data we want. ' in order to get the specific file, we use the primary key ID which is passed in ' the URL querystring variable "id" sql = "Select * from tblPlaces where placeID = " & request.querystring("id") ' Now create a record set to hold the data. "conString" is the connection string and is a variable which has it's ' value set in the include "vars.htm" file on line . ' Line 20 opens the recordset which I've imaginatively called "rsContent". rs being Record Set obviously ;} set rsContent = Server.CreateObject("ADODB.Recordset") rsContent.ActiveConnection = conString rsContent.Source = sql rsContent.CursorType = 3 rsContent.CursorLocation = 2 rsContent.LockType = 1 rsContent.Open() ' OK, now assign some values to some variables which we will later output to the screen ' We only want the text of the place and also the HTML to print. placeName = (rsContent.Fields.Item("placeText").Value) placesList = (rsContent.Fields.Item("placeHTML").Value) ' That's it. We have no more use for this record set object so tidy up rsContent.Close() Set rsContent = Nothing ' Now we have the data from we need stored in variables, its time to output stuff ' First, get the basic HTML stuff out of the way %> Peter Ellegard - International Freelance Travel Writer and Photographer <% ' ok, the title of the page is "placeName" so print it. VBScript uses "response.write" rather ' than anything sensible like "Print" :/ ' Also, use the & to join text together. ' Lastly, use " to escape special characters rather than the more usual \ ' So
has double quotes - one real one and one to escape the special char response.write("

" & placeName & "

") %> This is a list of countries and regions for which I have transparencies and/or digital images available. Please email or phone me if you want more details or to discuss prices
<% ' the last thing to output is the HTML list of areas. The data in the database is already in HTML so all ' we need to do here it print the variable using response.write response.write(placesList) %>