Solved

cmdreader.NextResult doesn't work!! why?

Posted on 2006-06-22
4
310 Views
Last Modified: 2008-02-01
the following is my code to display query result in asp.net application.
But it display duplicated result in my page, i think is becoz cmdreader.NextResult doen't work.

but why?

//////////////////////////////////////////////////////
pls note tat  cmdreader is [ OdbcDataReader]
//////////////////////////////////////////////////////

<%  If cmdreader.Read = True
   
          For x = 0 to count - 1
%>

<td><%= cmdreader("name")%> </td>    

<%     cmdreader.NextResult
       
          Next
       End If
%>
0
Comment
Question by:kengkit
  • 2
  • 2
4 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 16966772
<% while (cmdreader.Read)  
        %>

<td><%= cmdreader("name")%> </td>    

<%     cmdreader.NextResult
        End while
          %>

try this

hope it helps u :)
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 50 total points
ID: 16967264

Hai,

cmdreader.NextResult is not needed.Read( ) method advances to next record automatically

Use this code alone
<% while (cmdreader.Read())  
        %>

<td><%= cmdreader("name")%> </td>    

<%  End while
          %>

regards
Pradeep
0
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16967311
Hai,

cmdreader.NextResult is not needed.Read( ) method advances to next record automatically.
Both cmdreader.NextResult and Read( ) method advances to next record automatically.So that only you got the problem.pratima_mcs answer is also wrong



Use this code alone
<% while (cmdreader.Read())  
        %>

<td><%= cmdreader("name")%> </td>    

<%  End while
          %>

regards
Pradeep
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 16967522
yes pradeepsudharsan .u r right.i am wrong there.........
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question