Solved

cmdreader.NextResult doesn't work!! why?

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

10 Experts available now in Live!

Get 1:1 Help Now