Why recordset going to second table in dataset?

Discussion in 'ASP .Net' started by John Dalberg, Dec 12, 2005.

  1. John Dalberg

    John Dalberg Guest

    I am using the Enterprise library and did an executedataset to retrieve
    results into a dataset. I noticed that the result went into the second
    table in the table collection of the dataset instead of the first table.

    ds.Tables[0].Rows.count = 0 <--- why?
    while
    ds.Tables[1].Rows.count had the number of rows expected.

    Is there a reason for this behaviour?

    John Dalberg
    John Dalberg, Dec 12, 2005
    #1
    1. Advertising

  2. John Dalberg wrote:
    > I am using the Enterprise library and did an executedataset to
    > retrieve results into a dataset. I noticed that the result went into
    > the second table in the table collection of the dataset instead of
    > the first table.
    >
    > ds.Tables[0].Rows.count = 0 <--- why?
    > while
    > ds.Tables[1].Rows.count had the number of rows expected.
    >
    > Is there a reason for this behaviour?
    >
    > John Dalberg

    Are you using a SQL Server stored procedure? If so, did you remember to use
    "SET NOCOUNT ON" in the procedure to suppress the informational "x rows were
    affected" messages that are sent as resultsets?
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Dec 12, 2005
    #2
    1. Advertising

  3. John Dalberg

    KJ Guest

    There might be a select statement (in your sql) somewhere above that
    which is returning the rows. If not, I don't know the answer.
    KJ, Dec 12, 2005
    #3
  4. John Dalberg

    John Dalberg Guest

    "Bob Barrows [MVP]" <> wrote:
    > John Dalberg wrote:
    > > I am using the Enterprise library and did an executedataset to
    > > retrieve results into a dataset. I noticed that the result went into
    > > the second table in the table collection of the dataset instead of
    > > the first table.
    > >
    > > ds.Tables[0].Rows.count = 0 <--- why?
    > > while
    > > ds.Tables[1].Rows.count had the number of rows expected.
    > >
    > > Is there a reason for this behaviour?
    > >
    > > John Dalberg

    > Are you using a SQL Server stored procedure? If so, did you remember to
    > use "SET NOCOUNT ON" in the procedure to suppress the informational "x
    > rows were affected" messages that are sent as resultsets?


    The sp was created using VS2003 using the dataadaptor designer. Yes there's
    a 'set no nocount on' statement which was put by vs2003. All the sp does is
    a select using a join between two tables.

    When I run the sp in the query analyzer, I only see a single row which is
    expected. I am posting the sp below.

    CREATE PROCEDURE dbo.GetCustomers
    AS
    SET NOCOUNT ON;
    SELECT Customer.CustName, Contact.ContactName FROM Customer CROSS JOIN
    Contact GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO
    John Dalberg, Dec 13, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TB
    Replies:
    4
    Views:
    2,115
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    862
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,762
    Smokey Grindel
    Dec 2, 2006
  4. Hung Huynh
    Replies:
    8
    Views:
    289
    Bob Barrows
    Sep 24, 2003
  5. yelipolok
    Replies:
    4
    Views:
    242
    John W. Krahn
    Jan 27, 2010
Loading...

Share This Page