format data

Results 1 to 2 of 2

Thread: format data

  1. #1
    Join Date
    Dec 1969

    Default format data

    hello,<BR>i hope you guys can help me with this. i have a view (sql) that comes from 3 tables. it has id, lname, fname, contact_detail. one person can have many contact_detail (such as tel.#, email...). and i have to make it look like outlook, so name shows up only once and then all the contact_detail. <BR>this is my code<BR>strSQL = "select * from test_view" <BR>varX=""<BR>flag=true<BR>Response.Write "&#060;table&#062;"<BR>if rs.EOF then<BR> Response.Write "no records found"<BR>else <BR> while not rs.EOF <BR> str1=""<BR> str1="&#060;tr&#062;"<BR> for i = 1 to 4<BR> if not rs.EOF then<BR> if rs( 0 )=varX then<BR> str1=str1 & rs(3) & " : " & rs(4) & "<BR>"<BR> else<BR> if flag=true then<BR> flag=false<BR> str1 = str1 & "&#060;td&#062;"<BR> else<BR> str1=str1 & "&#060;/td&#062;&#060;td&#062;"<BR> end if <BR> str1 = str1 & rs(0) & ", " & rs(1) & "<BR>" & rs(2) & "<BR>" & rs(3) & " : " & rs(4) & "<BR>"<BR> varx=rs(0)<BR><BR> end if<BR> rs.MoveNext<BR> end if<BR> next<BR> str1=str1 & "&#060;/td&#062;&#060;/tr&#062;" <BR> Response.Write str1<BR> wend <BR>Response.Write "&#060;/table&#062;"<BR>end if<BR>%&#062;<BR>it looks like it loops only until it gets to a different id #, so i get one block with data that&#039;s right, but if there is any more data on the bottom it don&#039;t display it together.<BR><BR>i hope this makes sence and sorry if the post is too long<BR>thanks in advance,<BR>lana

  2. #2
    Join Date
    Dec 1969

    Default RE: format data

    if you look at your code, you&#039;re not writing anything until you&#039;ve reached your last record.<BR><BR>I.e., you&#039;re first Response.Write comes after rs.MoveNext.<BR><BR>Also, are you missing a loop?<BR><BR>jonathan

Posting Permissions

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