Professional Web Applications Themes

getting recordcount when using set RS = conn.execute - ASP Database

I dunno if this has been asked before but google didnt get my anything relevant. If i use set conn = Server.CreateObject("ADODB.Connection") strConn = "PROVIDER=MSDASQL; DRIVER={SQL Server}; SERVER=FERRARI;DATABASE=SWORDFISH; UID=application;PWD=tr4nsf0rm3r;" conn.open strConn strSQL = "exec usr_sel_companynames compname = '" & txtComp & "', compno = '" & cono & "', regpcode = '" & regPcode & "'" & _ ", tradpcode = '" & tradpcode & "', telNo = '" & telno & "', activity = '" & Activity & "', Holdingcompanyno = '" & Holdingcompanyno & "'" set RS = conn.execute(strSQL) to create a recordset how can i get the ...

  1. #1

    Default getting recordcount when using set RS = conn.execute

    I dunno if this has been asked before but google didnt get my anything
    relevant.

    If i use

    set conn = Server.CreateObject("ADODB.Connection")
    strConn = "PROVIDER=MSDASQL; DRIVER={SQL Server};
    SERVER=FERRARI;DATABASE=SWORDFISH; UID=application;PWD=tr4nsf0rm3r;"
    conn.open strConn

    strSQL = "exec usr_sel_companynames compname = '" & txtComp & "', compno =
    '" & cono & "', regpcode = '" & regPcode & "'" & _
    ", tradpcode = '" & tradpcode & "', telNo = '" & telno & "', activity =
    '" & Activity & "', Holdingcompanyno = '" & Holdingcompanyno & "'"

    set RS = conn.execute(strSQL)

    to create a recordset how can i get the recordcount.

    I have seen references to something like rowcount in sql server and wonder
    if maybe this should be used as an output parameter, tho not sure how to use
    output parameters.

    I know i cant use RS.recordcount as this returns -1

    any ideas

    TIA


    Steven Guest

  2. #2

    Default Re: getting recordcount when using set RS = conn.execute

    Check out the solution suggestions here.
    http://www.aspfaq.com/show.asp?id=2193 (You already know about the -1, so
    just skip that part!)

    Ray at work

    "Steven Scaife" <com> wrote in message
    news:%phx.gbl... 


    Ray Guest

  3. #3

    Default Re: getting recordcount when using set RS = conn.execute

    Use GetRows()


    Set RS = conn.execute(strSQL)
    If not RS.EOF then
    arrResults = RS.GetRows
    End If

    RS.Close
    Set RS = Nothing
    Conn.Close
    Set Conn = Nothing

    If isArray(arrResults) then
    intRecs = UBound(arrResults, 2) - 1
    Else
    intRecs = 0
    End If

    Cheers
    Ken



    "Steven Scaife" <com> wrote in message
    news:%phx.gbl... 


    Ken Guest

  4. #4

    Default Re: getting recordcount when using set RS = conn.execute

    Set RS = conn.execute(strSQL)
    If Not rs.EOF Then
    arrResults = RS.GetRows
    intRecs = UBound(arrResults, 2) + 1
    Else
    intRecs = 0
    End If
    rs.Close
    Set rs = Nothing


    "Ken Schaefer" <com> wrote in message
    news:%phx.gbl... [/ref]
    compno [/ref]

    >
    >[/ref]


    David Guest

  5. #5

    Default Re: getting recordcount when using set RS = conn.execute

    ooops :-)

    Cheers
    Ken


    "David Morgan" <me.uk> wrote in message
    news:e%phx.gbl... [/ref]
    > compno [/ref]
    > = 
    >>
    >>[/ref]
    >
    >[/ref]


    Ken Guest

Similar Threads

  1. Question Execute SQL satatements in perl using DBI execute method
    By bennjoe in forum Brainstorming Area
    Replies: 0
    Last Post: October 7th, 04:53 PM
  2. Replies: 1
    Last Post: April 1st, 06:40 PM
  3. trouble with db conn dsn
    By RJweb in forum Coldfusion Database Access
    Replies: 1
    Last Post: April 4th, 09:45 PM
  4. conn.open problem on client, not on server
    By Tim. D in forum ASP Database
    Replies: 5
    Last Post: August 5th, 08:35 AM
  5. reading sqldatareader after conn.close()
    By Ante Perkovic in forum ASP.NET General
    Replies: 0
    Last Post: July 2nd, 10:13 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139