Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Quick ASP Question!?

  • 08-02-2005 7:35pm
    #1
    Closed Accounts Posts: 539 ✭✭✭


    Hello,

    I'm just recently getting into asp for data manipulation for my site and server. I'm a little confused about the response.write functions. I'll give some code to explain...

    <% Response.Buffer=True %>
    <%
    dim RS 'recordset object
    Set RS = Server.CreateObject("ADODB.Recordset")
    dsn = "MyServer"
    sql = ("select * database")
    %>

    RS.Open sql, dsn

    Response.Write("<td bgcolor=#000080 nowrap valign=top align=center> <font color=#FFFFFF>" & f.Value & "</font> </td>")

    Now my question is, how can I get the code to run two separate queries?

    The reason I ask is I have tried to do something like

    sql = ("select * database")
    sql2 = ("select * database2")

    But I don't understand what f.value means and am not sure how to get this to output?!

    If anyone has an idea or knows what I'm talking about ;) I would be eternally indebted to you, if could help.

    Yurma


Comments

  • Closed Accounts Posts: 333 ✭✭McGintyMcGoo


    The f.value is the content of that field. In the code below, the contents of your recordset would be written into individual cells on the same row. Wherever f.value is found, the value of that record is written in it's place.
    'show the rows
    do while not RS.EOF
    Response.Write("<tr bgcolor=White>")
    
    for each f in RS.Fields
       Response.Write("<td bgcolor=#000080 nowrap valign=top align=center>&nbsp;<font color=#FFFFFF>" & f.Value & "</font>&nbsp;</td>")
       next
    	
       Response.Write("</tr>")
    
       RS.MoveNext
    loop
    

    To write more data from another query, I'd normally create another recordset with the other query. You could destroy the first one firstly if you were finished with it. Reuse the same connection object though.

    Hope this helps!


  • Closed Accounts Posts: 539 ✭✭✭Yurmasyurda


    The f.value is the content of that field. In the code below, the contents of your recordset would be written into individual cells on the same row. Wherever f.value is found, the value of that record is written in it's place.
    'show the rows
    do while not RS.EOF
    Response.Write("<tr bgcolor=White>")
    
    for each f in RS.Fields
       Response.Write("<td bgcolor=#000080 nowrap valign=top align=center>&nbsp;<font color=#FFFFFF>" & f.Value & "</font>&nbsp;</td>")
       next
    	
       Response.Write("</tr>")
    
       RS.MoveNext
    loop
    

    To write more data from another query, I'd normally create another recordset with the other query. You could destroy the first one firstly if you were finished with it. Reuse the same connection object though.

    Hope this helps!

    I think I get what you're saying, I'll give it a try and get back. Cheers!


Advertisement