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
%>
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
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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.........
%>
<td><%= cmdreader("name")%> </td>
<% cmdreader.NextResult
End while
%>
try this
hope it helps u :)