Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

cmdreader.NextResult doesn't work!! why?

Posted on 2006-06-22
4
Medium Priority
?
318 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

772 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