Maintain state in ASP

Results 1 to 2 of 2

Thread: Maintain state in ASP

  1. #1
    Vince Kavanagh Guest

    Default Maintain state in ASP

    Hello,<BR><BR>I&#039m fairly new to asp and I have come across a problem, I have been trying to create a simple asp page that uses an SQL statement based on a URL request.querystring. Everything works fine, but if I then try to "page" through the recordset by setting pagesize I get an error;<BR><BR>ADODB.Recordset error &#039 800a0bcd&#039 <BR><BR>Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record. <BR><BR> this is on the first loop through.<BR><BR>I&#039m assuming that the querystring request has lost &#039state&#039 and that the SQL statement is invalid;<BR>subValue = Request("Subject")<BR>sql = "SELECT * FROM myTable WHERE MainSubject = &#039" & subValue & "&#039" <BR><BR>I have tried using a JS dynamic array and a VB script array to store the subValue, but I can&#039t get either to work, (I&#039m fairly new to programming as well).<BR>&#060;%<BR>subValue = Request("Subject")<BR>Response.Write(subValue)<BR> &#039Increment<BR>For i = 1 to Len(subValue)<BR> If Mid(subValue, i, 1)=" " Then<BR> subCounter = subCounter + 1<BR> End If<BR> Next<BR>subCounter = subCounter + 1<BR><BR> &#039Set value of Array<BR> Dim Found(100)<BR><BR>&#039Fill Array<BR>subFound = 1<BR>For i = 1 To Len(subValue)<BR> If Mid(subValue, i, 1) = " " Then<BR> subFound = subFound + 1<BR> Else<BR> Found(subFound) = Found(SubFound) + Mid(subValue, i, 1)<BR> End If<BR>Next<BR><BR>&#039SQL<BR><BR>sql = "SELECT * FROM myTable WHERE MainSubject = &#039" & subValue & "&#039" <BR><BR><BR>I have been trying to do this with scripting alone, as I did not want to resort to session ID&#039s or cookies etc, after all seem to manage it ok.<BR>I just can&#039t figure out a way of holding the value of the querystring while I loop through the record count.<BR><BR>Any help would be much appreciated.<BR><BR>Regards,<BR><BR><BR>Vince<BR>< BR>ps. If you&#039ve written a book about it, I&#039ll buy it!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Maintain state in ASP

    First things first. A good way to test to see if your SQL string is being constructured correctly is to put a:<BR><BR>Response.Write sql<BR><BR>right after your statement that constructs your sql string (sql = "SELECT * FROM myTable WHERE MainSubject = &#039" & subValue & "&#039"). This will let you see the value of sql, so you&#039ll be able to determine if that is the problem or not.<BR><BR>Second, to use PageSize, you cannot use the default recordset cursor type. Since you did not show us your connection and recordset code, I don&#039t know if this is a problem for you or not, but I highly suggest you check out and These should be good starting points for learning more about recordset cursors.<BR><BR>Good luck, and keep posting here if you get stuck! :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts