This is the result of a JOINed query:
question answer
1 a1
1 a2
1 a3
1 a4
2 a1
2 a2
2 a3
2 a4
How would I use a DataReader to output this data without repeating each
question 4 times?
Do I weed out the repeated question in C# with a while loop?
Or is there a way to do this in the SQL statement?
Thank you for your time and help! 6 2496
Give an example of what you would like to see in the result record set.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<de*******@yaho o.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
This is the result of a JOINed query:
question answer
1 a1
1 a2
1 a3
1 a4
2 a1
2 a2
2 a3
2 a4
How would I use a DataReader to output this data without repeating each
question 4 times?
Do I weed out the repeated question in C# with a while loop?
Or is there a way to do this in the SQL statement?
Thank you for your time and help!
Look at my example code (downloadable) at http://sholliday.spaces.live.com/ 5/24/2006
Where I populate the Customers, and their (child) Orders, without repeating.
<de*******@yaho o.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
This is the result of a JOINed query:
question answer
1 a1
1 a2
1 a3
1 a4
2 a1
2 a2
2 a3
2 a4
How would I use a DataReader to output this data without repeating each
question 4 times?
Do I weed out the repeated question in C# with a while loop?
Or is there a way to do this in the SQL statement?
Thank you for your time and help!
I simply want to output 4 answers for every question without repeating
the question.
(with a datareader if possible)
Eliyahu Goldin wrote:
Give an example of what you would like to see in the result record set.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<de*******@yaho o.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
This is the result of a JOINed query:
question answer
1 a1
1 a2
1 a3
1 a4
2 a1
2 a2
2 a3
2 a4
How would I use a DataReader to output this data without repeating each
question 4 times?
Do I weed out the repeated question in C# with a while loop?
Or is there a way to do this in the SQL statement?
Thank you for your time and help!
Like this?
1 a1
a2
a3
a4
2 a1
a2
a3
a4
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<de*******@yaho o.comwrote in message
news:11******** **************@ d34g2000cwd.goo glegroups.com.. .
>I simply want to output 4 answers for every question without repeating
the question.
(with a datareader if possible)
Eliyahu Goldin wrote:
>Give an example of what you would like to see in the result record set.
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET]
<de*******@yah oo.comwrote in message news:11******* *************** @b28g2000cwb.go oglegroups.com. ..
This is the result of a JOINed query:
question answer
1 a1
1 a2
1 a3
1 a4
2 a1
2 a2
2 a3
2 a4
How would I use a DataReader to output this data without repeating each
question 4 times?
Do I weed out the repeated question in C# with a while loop?
Or is there a way to do this in the SQL statement?
Thank you for your time and help!
Exactly! But I'm having trouble writing the SQL code for this. Also,
this kind of model wouldn't work well with DataReader, since it read
one row at a time.
Would a DataSet be better here? (easier, perhaps?)
Eliyahu Goldin wrote:
Like this?
1 a1
a2
a3
a4
2 a1
a2
a3
a4
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<de*******@yaho o.comwrote in message
news:11******** **************@ d34g2000cwd.goo glegroups.com.. .
I simply want to output 4 answers for every question without repeating
the question.
(with a datareader if possible)
Eliyahu Goldin wrote:
Give an example of what you would like to see in the result record set.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<de*******@yaho o.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
This is the result of a JOINed query:
question answer
1 a1
1 a2
1 a3
1 a4
2 a1
2 a2
2 a3
2 a4
How would I use a DataReader to output this data without repeating each
question 4 times?
Do I weed out the repeated question in C# with a while loop?
Or is there a way to do this in the SQL statement?
Thank you for your time and help!
No, you can't make a simple sql query for that. You could write a stored
procedure, but it is much easier just to do it in the code with a while
loop, as you say. A good place for this is PreRender event for the control
you use for rendering the data (GridView, repeater, etc). In this event the
control is already fully built and you can loop through the Items
collection.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<de*******@yaho o.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Exactly! But I'm having trouble writing the SQL code for this. Also,
this kind of model wouldn't work well with DataReader, since it read
one row at a time.
Would a DataSet be better here? (easier, perhaps?)
Eliyahu Goldin wrote:
>Like this?
1 a1 a2 a3 a4 2 a1 a2 a3 a4
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET]
<de*******@yah oo.comwrote in message news:11******* *************** @d34g2000cwd.go oglegroups.com. ..
>I simply want to output 4 answers for every question without repeating
the question.
(with a datareader if possible)
Eliyahu Goldin wrote: Give an example of what you would like to see in the result record set.
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET]
<de*******@yah oo.comwrote in message news:11******* *************** @b28g2000cwb.go oglegroups.com. ..
This is the result of a JOINed query:
question answer
1 a1
1 a2
1 a3
1 a4
2 a1
2 a2
2 a3
2 a4
How would I use a DataReader to output this data without repeating
each
question 4 times?
Do I weed out the repeated question in C# with a while loop?
Or is there a way to do this in the SQL statement?
Thank you for your time and help!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Grant |
last post by:
I am connecting to an access database using a datareader in C#. I get
results when I run a certain query from Access but when I run it from Code
it does not retrieve any results. I have put a stop point after the string
is created and it is correct. Its an inner join query so I was wandering
whether that is too complicated for a datareader to execute, or if Im
missing something else here?
Heres what Im doing in code:
...
|
by: Rob Wire |
last post by:
For the code below, how could I add an item in the drop
down lists for both company and location to be an "All"
selection that would send to the stored proc.
spRptAttachments a value of "%" so that it would bring
back all attachments at all companies or all locations at
a company? Thank you, Rob.
Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
|
by: Maziar Aflatoun |
last post by:
Hi everyone,
I am working on the 'Delete' section of my program. What I need to do is
query my database and for every ID that it finds I want to remove a
file+ID.jpg from my file folder and update another table with that
information. However, I'm getting the following error message.
There is already an open DataReader associated with this Connection which
must be closed first.
Description: An unhandled exception occurred during the...
|
by: Beren |
last post by:
Hello,
I have an sproc to query a couple of tables, that have the same fieldnames,
for example DateCreated.
-------------------------------------
Select a.* , b.* From tablea a
Join table b On b.keyfield = a.keyfield
-------------------------------------
|
by: DaveS |
last post by:
Hi!
I am trying to create a DataReader in .Net 2003, retrieving data from an
Access backend db. In the code below, when I put a breakpoint within
the While...Read() loop, the datareader returns five records (which is
correct). However, when I simply run the program without the
breakpoint, only one record is being returned. Is there something I'm
missing???? The connection state is "Open", so I'm not sure why all
records aren't being...
| |
by: Ivan Weiss |
last post by:
Hey all, I have the following code to populate a ListView control from
my Access database. The listview is displaying a list of saved projects
that the user will be able to open, edit, or delete to work on. I know
that the DataReader is more efficient and faster than a dataset, but I
was not able to figure out how to implement it. Here is the code I have
now which works:
Private Sub frmProjects_Load(ByVal sender As System.Object,...
|
by: JC Voon |
last post by:
Hi:
The following query
SELECT Inv.*, Cust.CompanyName AS Cust_Name FROM Inv JOIN
Customers ON Customers.CustomerID=Inv.Cust_No
When execute the DataReader.GetSchemaTable method,
it will return all fields i specified in the query (inv.*, Cust_Name)
plus the field in the JOIN criteria, "CustomerID".
|
by: robecflo |
last post by:
Hi Forum, i have a problem, hope somebody can give me ideas. I'm
developing with windows forms and vb.net, and oracle as a database. At
this moment i have a table called amortizaciones, this table has a
field called id_pasivo, which is foreign key to another table called
pasivo, a consecutive field called no_cupon and a third field called
date. So when i make a query (i.e select * from amortizaciones where
id_pasivo = 522 order by...
|
by: jimmy |
last post by:
Hi again,
sorry for posting two questions so close together but im working on a
school project which is due in soon and running into some difficulties
implementing the database parts. I have the code below which when
executed generates the following error message: 'There is already an
open datareader with this command which must be closed first'
Private Sub MainMenu_Load(ByVal sender As System.Object, ByVal e As
|
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...
|
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...
| |
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |