Why recordset going to second table in dataset?

J

John Dalberg

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
 
B

Bob Barrows [MVP]

John said:
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?
 
K

KJ

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.
 
J

John Dalberg

Bob Barrows said:
John said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top