error: "No data exists for the row/column"

C

Chris

Hi,

I want to show the whole recordset. There are 42 records and 2 fields.
....
comd = New System.Data.OleDb.OleDbCommand("select name,lok from pc",
oConnection)
dtreader = comd.ExecuteReader
for i=0 to 41
for j=0 to 1
dtreader.Read()
f=dtreader.item(j)
Response.Write(f)
next
Response.Write("<br>")
next
....

I get the error: "No data exists for the row/column"
I didn't defined any table, so why row/column error?
Thanks
 
J

Jeff Dillon

You have 42 rows, but you are attempting to read it 84 times. You have a
loop within a loop. Perhaps you want your Read() outside of the inner loop

Jeff
 
C

Chris

Of course, thanks a lot.


Jeff Dillon said:
You have 42 rows, but you are attempting to read it 84 times. You have a
loop within a loop. Perhaps you want your Read() outside of the inner loop

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top