Forums
This topic is locked
How to display a specific record within a table?
Posted 03 Sep 2001 00:45:19
1
has voted
03 Sep 2001 00:45:19 Julian Hockings posted:
Is there a better way to display a specific record within a table based on its ID than the way I'm currently doing it:I'm creating a content publishing system where the users want to be able to change sentences within the site. I've made these dynamic sentences all different records in a table. Now, say a certain page has five dynamic sentences in it, I currently have five different recordsets, each one tuned to the specific sentence I want like so:
SELECT *
FROM tbl_sentences
WHERE SentenceID = 5
Is there a more elegant way to do this? Anyone? Is this method processor or bandwidth intensive? Is there an extension that does this kind of thing?
Thanks!
Replies
Replied 03 Sep 2001 01:24:44
03 Sep 2001 01:24:44 Owen Eastwick replied:
What's the relationship between the 5 sentences? Is it that they appear on the same page?
In which case create a table with the following fields:
SentenceID, PageID, Sentence
Then:
Select *
FROM tbl_sentences
WHERE PageID = n
WHERE n is the PageID number for the page the user wishes to ammend. Using the method below n would derived from a Request.QueryString
You could then have another table tbl_Pages with the following fields:
PageID, PageTitle, PageDescription
You could use this database table to create a Dynamic List on a page from which the user can select the page they want to edit. Create a recordset on the page as follows:
Select *
FROM tbl_Pages
Create the list using the repeat region server behavour. Then make the PageTitle a link using the Go To Detail Page server behaviour using PageID as the Identifier. On the detail page instead of just displaying the text, use the dynamic text as the default values within the text boxes, within a form, so as to allow the user to edit and update the sentences held within the sentences table.
Hope that all makes sense.
Regards
Owen.
www.tdsf.co.uk/tdsfdemo
In which case create a table with the following fields:
SentenceID, PageID, Sentence
Then:
Select *
FROM tbl_sentences
WHERE PageID = n
WHERE n is the PageID number for the page the user wishes to ammend. Using the method below n would derived from a Request.QueryString
You could then have another table tbl_Pages with the following fields:
PageID, PageTitle, PageDescription
You could use this database table to create a Dynamic List on a page from which the user can select the page they want to edit. Create a recordset on the page as follows:
Select *
FROM tbl_Pages
Create the list using the repeat region server behavour. Then make the PageTitle a link using the Go To Detail Page server behaviour using PageID as the Identifier. On the detail page instead of just displaying the text, use the dynamic text as the default values within the text boxes, within a form, so as to allow the user to edit and update the sentences held within the sentences table.
Hope that all makes sense.
Regards
Owen.
www.tdsf.co.uk/tdsfdemo
Replied 03 Sep 2001 01:28:29
03 Sep 2001 01:28:29 Julian Hockings replied:
Thanks, but that seems more complicated than the method I used, however slightly more elegant. ; )