Custom Recordset Has Rows, No Data

Results 1 to 3 of 3

Thread: Custom Recordset Has Rows, No Data

  1. #1
    Join Date
    Dec 1969

    Default Custom Recordset Has Rows, No Data

    Hi,<BR> I am using a custom record set to store data from another search so I can build a custom SQL statement. What is happening is that I am getting the number of rows in the customrs but no data. So, from the code below I am getting: Dept - Dept - Dept - Dept - Dept - Dept - Dept - ; exactly the number that the first statment returned, but no data. Any help would be appreciated.<BR><BR>Brandon<BR><BR><BR>&#039make a cutom recordset for use later<BR>Dim customRecordSet<BR>set customRecordSet = Server.CreateObject("ADODB.Recordset")<BR>customRe cordSet.Fields.Append "ID", adint, 2 <BR>customRecordSet.Fields.Append "dept_ID", adVarChar, 10 <BR>customRecordSet.Open <BR><BR><BR>dSQL="Select Dept_ID from gen_Departments where Div_ID=&#039"&Div&"&#039"<BR> dSQL, connectme<BR>Do Until rs.eof<BR>ccount=ccount+1<BR>Dept_ID=RS("Dept_ID") <BR><BR>customRecordSet.AddNew<BR>customRecordSet( "ID") = ccount<BR>customRecordSet("dept_ID") = Dept_ID<BR>customRecordSet.Update<BR><BR>rs.movene xt<BR>loop<BR>rs.close<BR><BR>&#039Move to the first record in our custom recordset<BR>customRecordSet.MoveFirst<BR><BR>&#03 9Loop through the recordset...<BR>Do While Not customRecordSet.EOF<BR> Response.Write ("Dept - "&customRecordSet("dept_ID"))<BR> customRecordSet.MoveNext<BR>Loop

  2. #2
    Gary Van Sluis Guest

    Default RE: Custom Recordset Has Rows, No Data

    You might want to try. <BR>customRecordSet.fields("dep_id").value<BR>I know this is not different but I recently had something similar and found this method to work. <BR><BR>Side note - Your methods looks quite costly on the server performance, from your code you get a recordset say 1-100, create a new recordset 1-100 and add an interger ID, then loop though the records again 1-100. Why dont you just use the original recordset? The interigers you are inserting are there<BR>rs(i). Maybe I am missing something but it looks like a lot of work for you server.

  3. #3
    Join Date
    Dec 1969

    Default You are absolutely right....

    Unfortunately, that didn&#039t work for the custom record set but no need, you are absolutely right about using the original rs. That was a rather stupid oversight on my part. Thanks.<BR><BR>Brandon

Posting Permissions

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