473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Displaying a 1-many relationship properly

Hi!

I just run into a problem wich some of you might be able to solve
really quickly so i decided to give this group a shot.

In the database a have 2 tables (well, to make it easy here).
1) Question
2) Answer

Each question has multiple answers attached to it. this means that
your will get the following result set.
---------------------------
quesion1 (type 1) -- answer1q1
quesion1 (type 1) -- answer2q1
quesion1 (type 1) -- answer3q1

quesion2 (type 1) -- answer1q2
quesion2 (type 1) -- answer2q2

quesion3 (type 2) -- answer1q3
quesion3 (type 2) -- answer2q3
quesion3 (type 2) -- answer3q3
quesion3 (type 2) -- answer4q3
---------------------------

Now each question has also a 'type'.

The problem:

I would like to display the question,if type 1, in a single line with
behind it a select box with all the answers in it. So display the
question once and put the answers to that question in a selectbox.

I have no idea how many questions or how many answers each question
has...

anyone any idea's ??
Nov 15 '05 #1
2 1087
Hi,

just create two datasets and bind them to a listbox, datagrid or some
otherview.
In the first dataset, you load all your questions. On selection changes in
the question grid,
you just update the SELECT statement of the second dataset (the answers). I
guess you
linked the answers to the questions through some primary/foreign keys ?
That's the global scenario.

Greetings,

Bram

"Frank" <fr***@hubhop.com> wrote in message
news:6c**************************@posting.google.c om...
Hi!

I just run into a problem wich some of you might be able to solve
really quickly so i decided to give this group a shot.

In the database a have 2 tables (well, to make it easy here).
1) Question
2) Answer

Each question has multiple answers attached to it. this means that
your will get the following result set.
---------------------------
quesion1 (type 1) -- answer1q1
quesion1 (type 1) -- answer2q1
quesion1 (type 1) -- answer3q1

quesion2 (type 1) -- answer1q2
quesion2 (type 1) -- answer2q2

quesion3 (type 2) -- answer1q3
quesion3 (type 2) -- answer2q3
quesion3 (type 2) -- answer3q3
quesion3 (type 2) -- answer4q3
---------------------------

Now each question has also a 'type'.

The problem:

I would like to display the question,if type 1, in a single line with
behind it a select box with all the answers in it. So display the
question once and put the answers to that question in a selectbox.

I have no idea how many questions or how many answers each question
has...

anyone any idea's ??

Nov 15 '05 #2
"Bram" <bv*****@nospam.skynet.be> schreef in bericht
news:40*********************@news.skynet.be...
just create two datasets and bind them to a listbox, datagrid or some
otherview.
In the first dataset, you load all your questions. On selection changes in the question grid,
you just update the SELECT statement of the second dataset (the answers). I guess you
linked the answers to the questions through some primary/foreign keys ?
That's the global scenario.


That is also the reason why many database frontends are slow, programming
isn't just attaching a recordset to a grid/listcontrol.

You can use just one dataset and when loading the questions (primary key
data) store the rowindex (or bookmark) of each first row from the primary
key (some grids have a rowdata or rowtag property, a invisible column can
be used too).

When a user selects a row of the questions list, move to the stored row
(from the index/bookmark you stored) and update the second control (movenext
till the primary key changes or EOF reached).

This gives you a faster GUI reducing server balast and network I/O.

Rene
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Waguih Boctor | last post by:
Hi, I have a number of ASP pages where some JPGs and GIFs are displaying in the browser and some are not. I have included an excerpt from the HTML below. In this example, the gif file at the...
8
by: euang | last post by:
Hi, I have been using access 2000 for two years on WINDOWS NT to display dynamic aweb page using ASP My ISP has now changed to Windows 2003, and I am having major problems displaying...
1
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time...
2
by: Joe Price | last post by:
Hi chaps I've got an XML file, within that file i've embedded html code using the <!]> tag I'm displaying that xml file through a browser using an xsl style sheet. However it is displaying...
1
by: Yoshitha | last post by:
hi I have datalist control in my ASP.NET application the problem here is i have used a textbox with multiline true propertly when i enter data like "fdjsfhjksdhfjsdfhsdjhfsdfhsdjfhsd...
2
by: Carole MacDonald | last post by:
There have been lots of posts on this topic, but I haven't been able to apply any of the suggestions to my situation. I have an .aspx page with a form on it that has several submit buttons on...
5
by: Robert | last post by:
Hello Accessors I have some reports created in Access that are very good for what they do. However, it seems to me that when you are displaying information you don't need to print out that a...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
0
by: dipper | last post by:
I have a dataset with several tables. Now i want to create different dataviews displaying results from some of the tables. I manage to create a view displaying 1 table, but how do i create a view...
33
by: buss123 | last post by:
Hi all, combo box script code was working in IE perfectly with all modes but OnChange event was not working in FireFox(editable mode, if we select valuese that combo box values r...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.