ADO.Net and Left outer join

G

Guest

Hi,
I created a stored proc in SQL Server 2000 that returns the result of a left
outer join. For example:
CREATE PROCEDURE MyProc ... AS
BEGIN
SELECT ...
FROM TableA AS A LEFT OUTER JOIN TableB AS B ON A.KeyA = B.KeyB
WHERE ...
END
When I call the stored procedure in the query analyser, I get the correct
result. When I use an ADO.Net in my C# application, I only get the rows for
which no match was found in table TableB (and thus only get null fields for
my B table).
To excute the SP, I call the SqlCommand.ExecuteReader() method after adding
my parameters and setting my CommandType to StoredProcedure. I tried using
both datasets and datareaders but they both have the problem.
 
E

Earl

I'm speculating that either your WHERE statement or your parameter setup in
the sp is the issue, since presumably, your WHERE is where you are calling
for your parameter match. As someone pointed out to me not long ago, watch
the app call the sp in the Profiler and you should be able to see what's
going on.
 

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

Top