Solved

cmdreader.NextResult doesn't work!! why?

Posted on 2006-06-22
4
308 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now