locked
img from mssql in table like layout RRS feed

  • Question

  • User-1335348149 posted

    Hi

    I have 100+ images stored in my mssql that I would like to have on a website.

    I have created this loop

    Response.Write("<table style='width:80%' align='center' border='1'>")
    If rs.BOF And rs.EOF Then
    ' No data
    Else
    Do While (Not rs.EOF)
    Response.Write "<tr><th>" & rs("image") & "<br>" & rs("titel") & "</th></tr>"
    rs.MoveNext
    Loop
    End If
    Response.Write("</table>")

    It gives me a laout like 

    table

    tr

    td

    td

    td

    td

    td

    ...

    /tr

    /table

    I would like it to be 

    table

    tr

    td td td td td td

    /tr

    tr

    td td td td td td

    /tr

    tr

    td .......

    /tr

    /table

    How do I accomplish that?

    Tuesday, April 7, 2020 7:20 PM

All replies

  • User-848649084 posted

    Hi,

    You coul dtry below code:

      Response.Write("<table style='width:50%' align='center' border='1'>")
        Response.Write "<tr><th> fname </th><th> lname</th></tr>"
            If str.BOF And str.EOF Then
            ' No data
            Else
            Do While (Not str.EOF)
            Response.Write "<tr><td>" & str("fname") & "</td><td>" & str("lname") & "</td></tr>"
            str.MoveNext
            Loop
            End If
            
    Response.Write("</table>")

    Regards,

    Jalpa

    Wednesday, April 8, 2020 8:23 AM
  • User-1335348149 posted

    That would not result in 

    table

    tr

    td

    td

    td

    td

    td

    td 

    /tr

    /table

    It would just give me

    table

    tr

    td

    td

    /tr

    ect

    /table

    Wednesday, April 8, 2020 6:39 PM
  • User-848649084 posted

    You could try as below:

     Response.Write("<table style='width:50%' align='center' border='1'>")
    
            If str.BOF And str.EOF Then
            ' No data
            Else
    		Response.Write "<tr>"
            Do While (Not str.EOF)
    		
            Response.Write "<td> <img src=" & str("img") & "> </td>"
    		
            str.MoveNext
            Loop
    		Response.Write "</tr>"
            End If
            
    Response.Write("</table>")
    

    Friday, April 24, 2020 9:41 AM