"Failed to load viewstate" when using random select command

E

Eric

Hi,

My page contains a select command like:
sql = "select * from mytable order by field1;"
comd = New SqlCommand(sql, connection)
etc ...

viewstate is on.

This works perfect, but when i want a random select using the command:
sql = "select * from mytable order by NEWID();", i first get the page
correctly, but when clicking on a button causing a postback, i get:

Failed to load viewstate. The control tree into which viewstate is being
loaded must match the control tree that was used to save viewstate during
the previous request.

I understand why: the button causes a postback and so there is a different
recordset coming from the table which doen't match the previous recordset.

Do you have a solution for this?

Thanks
Eric
 

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,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top