Sir Problem Regarding Recordsets in Asp 3.0

asp India
  • 14 years ago

    Respected Sir,

    I have some problem regarding recordset. Sir I have wrote one stored procedure. I want to display the records from the stored procedure.

    Sir, My details about the problem is listed below:Stored procedure name is demo and it has the following data in it:
    Create procedure demo


    as
    (
    select * from demo
    )




    -------------------table fiels are id,name
    <%
    dim rs
    set rs=Server.createobject("Adodb.recordset")
    rs.open "Exec demo",con,1,2





    %>
    <%=rs("id")%>
    <%=rs("name")%>
    But i am getting only one record i want to get 10 records as there are 10 records available in table demo.
    Sir we can use the while loop or do while or for loop to get the remaining records but i don't want to use it i want to get the records without using any loops.


    Sir, Please solve my problem as quickly as possible.
    Thanking You,







  • 14 years ago

    Hi mohdzubairpasha

    Get your 10 record by adding the following code in your code:

    if not rs.eof then
    rsarray = rs.getrows()
    response.write(rsarray(0,0))
    end if


    Regards

    DoctorMahdi

  • 14 years ago

    select top 10 * from table

  • 14 years ago

    hello.

     

    you must do a do ... while ... loop to scan all your datas in the recordset

     

    ' do this while we have one more line

    do while not rs.EOF

    %>

    <%=rs("id")%>
    <%=rs("name")%>


    <br>

    <%

    ' go to the next line

    rs.MoveNext

    loop

    %>

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay