SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast lucky20's Avatar
    Join Date
    Oct 2010
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy displaying data in tabular format

    [asp/vbscript]
    Can any one tell me what's wrong in this code.

    I am displaying data in table format.I have used same mentioned in this link
    http://w3schools.com/ado/ado_display.asp


    An empty table is displaying without data and without columns.


    <table border="2" width=100%>

    <%
    OpenSqlConn

    sql="Select * from master_i"

    Set rs=Conn.Execute(sql)
    do while not rs.EOF
    %>
    <tr><td><%Response.Write(Item_id)%></td>
    <td><% Response.Write(Item_s)%></td>
    <td><%Response.Write(Unit_s)%></td>
    <%rs.MoveNext%>
    </tr>
    <%
    loop

    rs.close
    Conn.close
    %>

    </table>

    If any one know the correct code plz let me know.

    Thanks in advance.

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    an empty table means no values.

    make sure you have some data then it will display.

    put some test info in it's place as placeholders.

    Code ASP:
    <tr><td>xxxx<%Response.Write(Item_id)%></td>
    <td>yyyy<% Response.Write(Item_s)%></td>
    <td>zzzz<%Response.Write(Unit_s)%></td>
    <%rs.MoveNext%>
    </tr>

  3. #3
    SitePoint Enthusiast lucky20's Avatar
    Join Date
    Oct 2010
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got the solution..
    correct code is
    My sql connection is in another page. I included that one in this..


    <table>
    <%
    OpenSQLconnection

    sql_query="Select * from linvmast"

    Set rs=conn.Execute(sql_query)
    do while not rs.EOF
    %>

    <tr><td><%=rs("itid")%></td>
    <td><%=rs("iname")%></td>
    <td><%=rs("units")%></td>


    <%rs.MoveNext%>
    </tr>
    <%
    loop

    rs.close
    conn.close
    %>

    </table>


Bookmarks

Posting Permissions

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