Forums
This topic is locked
ASP and AccessDB Multiselect
20 Mar 2002 09:50:13 Tom Ka posted:
HelloOn my Site I'am presenting Books to my visitors.
I'm using an access Database where there is a table for the books. within this table, I have a field which looks up in another table with a category name. So on my site you can look general at all books or select just one category of books.
I created also forms with asp where I can add new books. But I only can assign one category to a book. I would like to change this so that I can use my webform and a select multiple field to assign more then one category to an book. My coding experience is not so well. so it would be very nice, if some one can provide a tutorial for a dummy with step by step instructions!?
to picture it out:
table one: id, bookname, isdn#, gif-name, description, category (lookup in table two > category)
table two: id, category (internal category name), categoryLink (this is text which is displayed at the page and is not allways the same text as in category)
prefered solution:
Webform to add a new book and have a select multiple field where I can select multiple values out of the field categoryLink from table two so that the book are stored in the DB with the apropriate values.
Please contact me if my english was tooo bad to make my question clear.
THaNX a lot's
Tom
Replies
Replied 20 Mar 2002 10:28:10
20 Mar 2002 10:28:10 Andrew Watson replied:
Add another field to the books table. Called Category2. On your addbook form add another list menu to input this field and add it to the db just as you did with the main Category field. Now each book will have a field Category and Category2 (and Category3, 4, 5, 6... if you so desire).
When filtering these records on your page, ie by category your Recordset select statement should say something like...
SELECT BookName FROM tblBooks WHERE Category = Request.Whatever("Category" OR Catgory2 = Request.Whatever("Category" OR .... and so on for as many categorys you wish.
Thats 1 way, you could also create a new table called tblBookCategories which has 2 fields, BookID and Category, This table can contain as many categories for a book as you want. Then use a query on this table and the books table to get your recordset.
Hope this is of help.
<center>
/-|||-<<{{(([[/\~~~o~~~/\]]))}}>>
____|________|________|____________________</center>
When filtering these records on your page, ie by category your Recordset select statement should say something like...
SELECT BookName FROM tblBooks WHERE Category = Request.Whatever("Category" OR Catgory2 = Request.Whatever("Category" OR .... and so on for as many categorys you wish.
Thats 1 way, you could also create a new table called tblBookCategories which has 2 fields, BookID and Category, This table can contain as many categories for a book as you want. Then use a query on this table and the books table to get your recordset.
Hope this is of help.
<center>
/-|||-<<{{(([[/\~~~o~~~/\]]))}}>>
____|________|________|____________________</center>