473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sql Data Reader

I have a SQL stored procedures which evaluate the values passed in parameters
and then based on those values reads the appropriate records.

I run the stored procedure in VS 2005 Debug mode and it successfully
executes and I can see the @@ROWCOUNT has the expected number of rows.

When I actually do this with my program, the datareader is returned with no
execption, but no rows are found in the reader.

So I change my Stored procedure to not even look at the parameter values
being passed and just return rows. When I run this version of the stored
procedure, I get plenty of rows returned.

I change my stored procedure and create 2 output parameters so that I can
echo back the parameter values which were received by the program. When I
rerun the program, nothing is returned back in those parameters but a bunch
of rows are returned.

I have dumped the values of the parameters before the invoking the
DataReader method and it looks good to me. What could possibly be wrong?
Aug 14 '06 #1
1 1686
sql output parameters are not returned until after all result sets have been
processed. add this loop after you have read your rows, then you can access
the output parameters:

while (reader.NextResult()) ;

-- bruce (sqlwork.com)

"Jim Heavey" <Ji*******@discussions.microsoft.comwrote in message
news:CE**********************************@microsof t.com...
>I have a SQL stored procedures which evaluate the values passed in
parameters
and then based on those values reads the appropriate records.

I run the stored procedure in VS 2005 Debug mode and it successfully
executes and I can see the @@ROWCOUNT has the expected number of rows.

When I actually do this with my program, the datareader is returned with
no
execption, but no rows are found in the reader.

So I change my Stored procedure to not even look at the parameter values
being passed and just return rows. When I run this version of the stored
procedure, I get plenty of rows returned.

I change my stored procedure and create 2 output parameters so that I can
echo back the parameter values which were received by the program. When I
rerun the program, nothing is returned back in those parameters but a
bunch
of rows are returned.

I have dumped the values of the parameters before the invoking the
DataReader method and it looks good to me. What could possibly be wrong?

Aug 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mike L | last post by:
I tried a sample of code in MSDN magazine, but now I'm stuck. What code has the best performance to populate a Data Grid with a SP? Below is the code I have, which might be completing the wrong...
2
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
4
by: Ram | last post by:
I am using ADO.Net data reader to retrieve data from main frame. I am getting timestamp which is 26 (yyyy-mm-dd hh- mm-ss.123456) bytes as sqltimestamp data type. I am using data reader to...
2
by: Joe | last post by:
Anyone can suggest the best method of reading XML and adding data to ListView? Here is the xml data structure:: <xml> <site> <url>http://www.yahoo.com</url> <lastupdate></lastupdate>...
0
by: Crazy Cat | last post by:
In the following code I retrieve data from a stored procedure that returns multiple resultsets (the results of the stored procedure have been stored in a datareader called reader). On each...
6
by: Jim Heavey | last post by:
I am new to SqlServer, have been using Oracle in a prior life. I have written a very simple stored procedure in SQL Server and it (the query) looks like the following... Select AD_ID,...
1
by: weird0 | last post by:
I have created a GridView and dynamically added data to it by creating a DataTable(as advised) and bound it with a reader. Then, assigned the DataSource of GridView to DataTable. But even that aint...
0
by: bill | last post by:
Can someone please show me what to do with this to show the data in a dataGrid for example? I'm not really sure what to do with it. I'm used to Vb6. Dim Con = New...
1
by: =?Utf-8?B?SkI=?= | last post by:
Hello My pgm1 (User Interface Level) passes an empty ArrayList to pgm2 (Business Logic Level). pgm2 then calls pgm3 (Data Access Level) to populate the ArrayList. Question1: When pgm2 gets...
1
by: dotnetnovice | last post by:
Hi everybody... I want to show data in the data gridview placed in my form after getting data from my data access layer class through a class... Here is my code in the data access layer class....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.