Loop errors!!

Results 1 to 2 of 2

Thread: Loop errors!!

  1. #1
    Join Date
    Dec 1969

    Default Loop errors!!

    Hello.<BR><BR>To create an array from a database (DSN connected), I am using:<BR><BR>var CATEGORIES = new Array (<BR>&#060;%<BR>sql = "SELECT SoftwareTypeName FROM tblSoftwareType"<BR>Set myRS = Server.CreateObject("ADODB.Recordset")<BR>myRS.Ope n sql, conn, 3, 3<BR><BR>On Error Resume Next<BR>myRS.MoveFirst<BR>do while Not myRS.eof<BR>%&#062;<BR>&#060;%= myRS.Fields("SoftwareTypeName")%&#062;,<BR>&#060;% myRS.MoveNext<BR>loop<BR>conn.close<BR>%&#062;&#03 9;&#039;)<BR><BR>If I view the source, this array has been created, but it does not come up on screen. (It has been set up so that the elements of the array appear in a select box which I know works, as I tested it with just writing in the array myself.) It says there are errors on the page also. If I then refresh the page, the screen is blank and there&#039;s an error in the source code which says:<BR><BR>"Operation is not allowed on an object referencing a closed or invalid connection."<BR><BR>It refers to the line "myRS.Open sql, conn, 3, 3"<BR>Am I just using the wrong type of loop or is it something else?<BR>Help?

  2. #2
    A Guest

    Default RE: Loop errors!!

    Try defining connection explicitly :<BR><BR>set conn = Server.Createobject(ADODB.Connection)<BR>conn.Open "DSN=bbb"

Posting Permissions

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