Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ann
Posting Yak Master
220 Posts |
Posted - 2007-02-27 : 17:36:44
|
I am running a stored procedure that contains 3 select statements from within my asp.net/c# app. I am using the following test code to iterate through the results:SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { string id = dr["anID"].ToString();}dr.NextResult();The problem is, if the first (or second) select result doesn't return anything, then I get nothing even though I have results within the other select statements (I know this to be true, because I run against anaylser for testing to see the results I should have).Any ideas on how I should be implementing this?Thanks |
|
dfiala
Posting Yak Master
116 Posts |
Posted - 2007-02-27 : 23:37:50
|
You need an outer loop. This should do the trick.do{ while(dr.Read()) { string id = dr["anID"].ToString();}}while(dr.NextResult()); Dean FialaVery Practical Software, IncNow with Blogging...http://www.vpsw.com/blogbabyMicrosoft MVP |
|
|
ann
Posting Yak Master
220 Posts |
Posted - 2007-02-28 : 09:17:03
|
ahhh...thanks! that did the trick! |
|
|
|
|
|