Dynamic Variables / recordsets. . . do they exist?

Results 1 to 2 of 2

Thread: Dynamic Variables / recordsets. . . do they exist?

  1. #1
    Join Date
    Dec 1969

    Default Dynamic Variables / recordsets. . . do they exist?

    hi all-<BR><BR>i am trying to write a function WHERE i need to create dynamic recordset name. for example, instead of creating THREE SQL statements, i want to pass in how many recordsets to create, giving each one a unique name so i can reference them later on. <BR><BR>the problems is when i try to concat the general recordset name to the dynamic numeric value, i get a syntax error:<BR>SET rsname+j = ... (where j is a numeric value)<BR><BR>what would the syntax be? i&#039ve tried rsname&j, rsname(j), CSTR(rsname+j), ....<BR><BR>using a WHERE clause is not permissable due to the fact that the stored procedure being called accepts only one ID value to retrieve. i can not re-write the stored proc due to requirements i was given.<BR><BR>but i can NOT get it to work... i get a &#039SYNTAX ERROR&#039 - can this be done? and if not, how come? what could i be missing? <BR><BR>CODE:<BR>----------------------------------------------------------------<BR>SUB printcols(colnums)<BR> for j=1 to colnums<BR> SQL = "sp_GetCarDetails &#039" + vID1 + "&#039"<BR> SET rscars+j = DBConn.Execute(SQL) &#039&#060;---- HERE<BR> next<BR>END SUB<BR><BR>&#039****INVOKE SUB, GET TWO RECORDSETS<BR>CALL printcols(2)<BR>----------------------------------------------------------------<BR><BR><BR><BR>thanks so much in advance!

  2. #2
    rajit Guest

    Default RE: Dynamic Variables / recordsets. . . do they ex

    perhaps you can try something like this.<BR>1. create a new rs named tmpRS (dim tmpRS as new adodb.recordset)<BR><BR>2. then: SET tmpRS = DBConn.Execute(SQL) <BR><BR>3. assign rscars & j to tmpRS and then reset tmpRS to nothing and then proceed to the next rs with the same logic

Posting Permissions

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