Re: Selecting Data

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: eric (eriic_at_spam.com)
Date: 06/03/04


Date: Thu, 3 Jun 2004 14:22:59 -0600

William,

No I am not using "join" in my query. My query is similar to this:

CREATE PROCEDURE GetOrders

 @OrderID varchar(10)

AS

SELECT *

FROM Orders O, OrderDetails Od

WHERE O.OrderID = @OrderID AND Od.OrderID = O.OrderID

GO

I am trying to load it into a typed dataset with tables: Order and Order
Details with a data relation using OrderID. I thought that the data
relation would take care of the mapping of data. So, do I need to do two
seperate queries to fill each table or can I use one query like above to
load data into both tables?

Thanks

"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:uoDMnCaSEHA.1128@TK2MSFTNGP11.phx.gbl...
> Does your Select Statement have the word JOIN in it? If so, this is the
> problem. The dataset is rejecting what doesn't fit. You need to do two
> separate queries filling the parent table with its adapater and the child
> with its adapter. If you have a typed dataset with the Relation defined,
> then that should be it b/c the DataRelation is already defined.
>
> In general, avoid SQL Statements with the word JOIN in them in ADO.NET
> unless you are positive you want to do otherwise.
>
> --
>
> W.G. Ryan, eMVP
>
> http://forums.devbuzz.com/
> http://www.knowdotnet.com/williamryan.html
> http://www.msmvps.com/WilliamRyan/
> http://www.devbuzz.com/content/zinc_personal_media_center_pg1.asp
> "eric" <eriic@spam.com> wrote in message
> news:%23dyfT4ZSEHA.1732@TK2MSFTNGP09.phx.gbl...
> > I am currently struggling working with data in multiple tables. Is it
> > better to have a single join based query versus seperate queries? I am
> > trying to fill a typed dataset with two tables with a one to many
> > relationship which is similiar to Order-Order Details relationship.
When
> I
> > pass my dataset to be filled in my data access layer using a single
joing
> > based query it only loads the data in the parent table in the dataset
and
> > not the order details table (child). When I display it in a datagrid it
> > shows the data in the order details table however only with the order
> table
> > not in the order details table. What am I doing wrong?
> >
> > Thanks
> >
> >
>
>



Relevant Pages

  • Re: Selecting Data
    ... The Adapter moves ... > No I am not using "join" in my query. ... > seperate queries to fill each table or can I use one query like above to ... >>> shows the data in the order details table however only with the order ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Multiple forms use one query
    ... The easiest way is to work with seperate queries, but it was a challenge to ... The main idea is to pas all the information for the query through a hidden ... look to only one of the cboSiteName boxes. ... E.g. if cboVersionCleared3 is clicked the query should take its ...
    (microsoft.public.access.queries)
  • Re: Getting a total control to find totals for last 7 days via a q
    ... efandango wrote: ... they require seperate queries. ... have been confusing (and likely frustrating) you. ... I can claim to find that 'type' of best week from the same query that will ...
    (microsoft.public.access.queries)
  • Help with counting total items using hierarchical data structure
    ... I'm having trouble coming up with a query to count the number of total ... seperate queries in loops and I know there must be an more efficient ... Automotive has 4 items within it (under Cars, Trucks & Vans) ...
    (comp.lang.php)
  • Re: Display totals on a form of selected data/Change query fields from form
    ... are you just trying to open the query to see the results? ... I set the criteria as you said and I can see how ... Also, even if I were to do this all using seperate queries, how do I ... get the form to display the totals? ...
    (microsoft.public.access.formscoding)