Link to home
Start Free TrialLog in
Avatar of kengkit
kengkit

asked on

cmdreader.NextResult doesn't work!! why?

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
%>
Avatar of Pratima
Pratima
Flag of India image

<% while (cmdreader.Read)  
        %>

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

<%     cmdreader.NextResult
        End while
          %>

try this

hope it helps u :)
ASKER CERTIFIED SOLUTION
Avatar of pradeepsudharsan
pradeepsudharsan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pradeepsudharsan
pradeepsudharsan

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
yes pradeepsudharsan .u r right.i am wrong there.........