473,659 Members | 3,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1100
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.c om> wrote in message
news:6c******** *************** ***@posting.goo gle.com...
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******** *************@n ews.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
2461
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 bottom of the example is displaying (I have others that don't), while the jpg file at the top isn't. Both files are in the same folder (visible bith physical in WE and virtual in CM) as the asp file itself. WHen not displaying, it displays instead...
8
5784
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 information from MEMO fields within the Access 2000 database. I have not had any problems before displaying MEMO fields on NT and have tried various tips to resolve this issue but no luck so far. I was wondering if anyone had come accross a similar...
1
508
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 store in the database. However asp recognizes the data type as date and displays the date instead of the time. If I change the data type in mysql to varchar then asp will display the time correctly, but I cannot do it this way. I want to be able...
2
2847
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 any html from the xml file as text, ie its displaying as text <br/> and <b> etc
1
2261
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 jfdsjfksdjfksdjkfjsdfjksdjfsdjfd fdsfhjsdhfjsdhfjf dsjf dsjfhjsdfhjksdh d fdsjf hsdjkfhdjsfhsdjfh ds
2
3439
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 it. Clicking a button will cause a web service action that returns XML. I would like to display this XML response on the page with the form. I know I can display XML in an IFRAME by pointing its source to an XML file. But I'm streaming the XML...
5
2217
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 printer-friendly report is not the best way to go. So, I tried converting one of my Access reports to an Access form. I selected the continuous view to allow displaying multple records but when I went to define my sorting and grouping there was none...
2
4332
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 displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
0
1206
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 displaying multiple tables? Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **...
33
5529
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 not dislaying if enter the data the it is inserting properly) javascript code follows pls help me to solve this problem function fnKeyDownHandler(getdropdown, e) { fnSanityCheck(getdropdown);
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.