ADO record set rs.MoveNext only works once...help

T

trint

Ok,
MoveNext is only moving to the next record once, then it stays on that
record unless I use these (which work just fine) MoveLast MoveFirst
MovePrevious.

private void btnNext_Click(object sender, System.EventArgs e)
{
ErrorLabel.Text = (rs.RecordCount.ToString());
// this code is used to prevent going to EOF
if(rs.RecordCount != 1)
{
if (!rs.EOF)
{
rs.MoveNext();
if (rs.EOF)
{
rs.MovePrevious();
}
PopulateSimpleNavigationForm();
}
}

Is it screwy because it is a WebApp? I can make a WinApp work just
fine with the same code.

Any help is sincerely appreciated.
Thanks,
Trint
 
B

Bill Gregg

I only see you using rs.MoveNext once. Did you mean to have

While (!rs.EOF)


instead of

If (!rs.EOF)


?


If you call rs.MoveNext one time, it's going to move 1 time. If you
want it to keep going, you need to keep calling it. Am I missing
something?
 

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

Top