Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Sql Data Reader

Reply
Thread Tools

Sql Data Reader

 
 
=?Utf-8?B?SmltIEhlYXZleQ==?=
Guest
Posts: n/a
 
      08-14-2006
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?
 
Reply With Quote
 
 
 
 
bruce barker \(sqlwork.com\)
Guest
Posts: n/a
 
      08-14-2006
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" <> wrote in message
news:CE5F748A-B9EF-4E50-AB71-...
>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?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could a change of SQL ports break a data reader? Bill in Kansas City ASP .Net 1 06-17-2005 01:55 AM
weird sql data reader thing... =?Utf-8?B?ZGhucml2ZXJzaWRl?= ASP .Net 5 04-03-2005 11:01 AM
Tools to extract data from SQL database and convert it into XML & insert XML data into SQL databases Harry Zoroc XML 1 07-12-2004 10:10 PM
Sql data reader =?Utf-8?B?emFn?= ASP .Net 1 05-11-2004 12:26 PM
Cross- Side Scripting and SQL data reader =?Utf-8?B?dmluZWV0YmF0dGE=?= ASP .Net 2 05-11-2004 03:41 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57