I have a small database which holds my FAQ's answers and questions. I want to be able to display the answers and questions on my FAQ's web-page but not in the same order they appear in the database. I will also probably add to the database as time goes on.
The database is created thus:
CREATE TABLE [FAQS] (
[Field] [smallint] IDENTITY (1, 1) NOT NULL ,
[Question] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Answer] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
PRIMARY KEY CLUSTERED
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
The Answer field will often contain HTML.
I am using the following SQL statement:
SELECT Field, Question, Answer FROM FAQS order by Field ASC
and then using Response.Write to get the value from the database - but of course it only writes values from the top record.
For example, I want to be able to place the Answer from record 3 in one place on the HTML and another Answer from another record somewhere else.
How do I write values of rows that I specify?
Should I be using a loop, an array or something else?
'The first number indicates how many records to copy
'The second number indicates what recordnumber to start on
response.write("<p>This example returns the value of the first three columns in the second record:</p>")
I'll use this format to now write the FAQ's page, placing questions, answers and anchors.