Help with string to array to recordset

Results 1 to 2 of 2

Thread: Help with string to array to recordset

  1. #1
    Dvorak Guest

    Default Help with string to array to recordset

    I have a function that uses a "for each" loop to create an html formatted table of any database table, given the name of the table. Currently the function writes out all column names that appear in the table. I would like to allow the user to pass a comma-delimited list of the columns to draw. I need some help with how to parse the list and create the sql though.<BR><BR>Here is the function:<BR><BR>FUNCTION drawTableHead(x8_what)<BR> <BR> sql = "SELECT * FROM "& x8_what<BR> set rs = Conn.Execute(sql)<BR> &#039;Draw table<BR> <BR> FOR EACH field in rs.fields<BR> %&#062;<BR> &#060;td type="String"&#062;&#060;;&#060;/td&#062;<BR> &#060;%<BR> NEXT<BR> <BR> rs.close<BR> set rs = Nothing<BR><BR>END FUNCTION<BR>%&#062;

  2. #2
    Dvorak Guest

    Default RE: Help with string to array to recordset

    Actually, I just noticed that I can just pass the field names as a comma-delimited string in the function and load that string into the SELECT clause as is. <BR><BR>function becomes:<BR>drawTableHead("field1,field2,field3,et c","tablename")<BR><BR>SELECT " & firstArgument & " FROM " & secondArgument

Posting Permissions

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