What is wrong with this recordset? Expert help needed..

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default What is wrong with this recordset? Expert help needed..

    Hi - using ASP/Access/Vbscript

    Using the recordset below to insert a hit in my database each time the page is
    viewed by a user.
    Like a "how many times page is displayed record".

    But sometimes the whole webpage crashes. It started to happen after I used
    this recordset, so I think that it may be the reason.

    Is there an expert out there that can look at it an tell me if the recordset
    is ok or bad.
    Here it is; (viewCount is the DB table that holds the hits).

    <%
    Dim profiler
    Dim profiler_numRows

    Set profiler = Server.CreateObject("ADODB.Recordset")
    profiler.ActiveConnection = MM_mypage_STRING
    profiler.Source = "SELECT * FROM profiler WHERE ID = " +
    Replace(profiler__MMColParam, "'", "''") + ""
    profiler.CursorType = 0
    profiler.CursorLocation = 2
    profiler.LockType = 3
    profiler.Open()
    profiler("ViewCount") = profiler.Fields.Item("ViewCount").Value + 1
    profiler.Update

    profiler_numRows = 0
    %>

    Any comments? Other way to do this?

    Bjorn.

    btn Guest

  2. Similar Questions and Discussions

    1. Some Guidance from an expert needed for beginner...
      Over the last couple of days I have been reading through the documentation to try to find a solution for a project I am working on and I was hoping...
    2. Expert opinion needed: web services
      I want to (a) capture every SOAP request and log them and (b) implement security for a web service which just entails hitting a database for a...
    3. Expert needed: Help with uploading a file
      Hello, We have some code (see below) that has been working intermittently and I was wondering if someone had a better approach or an idea on why...
    4. File IO expert needed
      I need to learn from someone how to do the following: -a sprite gets clicked // this causes a cell on a pre-made Access spreadsheet to add 1, and...
    5. Select DISTINCT issue (SQL Expert needed)
      I have a database that I'm pulling out to an ASP page... I am looking for a wildcard string in a field. If the wildcard is found I just want ONE...
  3. #2

    Default Re: What is wrong with this recordset? Expert help needed..

    I think the correct syntax is:

    profiler.Fields("ViewCount") = profiler.Fields.Item("ViewCount").Value + 1

    Just a wild guess, however, according to this code sample at ASP101:

    [url]http://www.asp101.com/samples/viewasp.asp?file=db%5Fupdate%2Easp[/url]

    Best regards,
    Chris


    Chris In Madison Guest

Posting Permissions

  • You may not post new threads
  • You may 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