Narrowing a Recordset


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Narrowing a Recordset

  1. #1
    Martin H. Berwanger Guest

    Narrowing a Recordset


    I have been using the below code to insert a CLOB into my database. I've noticed
    a long delay before the record is updated. Being that I have to retrieve
    all the records in this one table and then loop through ever entry before
    I finally update the record, with the increasing size of this table this
    isn't a realistic method. Please Help, martin@hireplanet.com

    Is there anyway to :
    A - narrow the resultset
    or
    B - another way to insert a CLOB

    Set oRsConn = Server.CreateObject("ADODB.Connection")
    oRsConn.open "blah", "www_server"
    Set oRs = Server.CreateObject("ADODB.Recordset")

    oRs.Open "test", oRsConn, adOpenStatic, adLockPessimistic, adCmdTable
    If Not oRs.EOF Then
    oRs.MoveFirst
    Do Until Trim(oRs.Fields("user_id")) = aspUser_id
    oRs.MoveNext
    Loop

    oRs.Fields("test_text") = aspLargeCharObject
    oRs.Fields("test_status") = 1
    oRs.Update
    End If
    oRS.Close
    Set oRS = Nothing

  2. #2
    Kimoanh T. Vo Guest

    Re: Narrowing a Recordset


    Martin,
    To narrow down the result set, include a where clause in your sql statement.

    sqlStmt = "select... from... where <primary_key> = '" & aspUser_id & "'"
    oRs.Open sqlStmt, oRsConn, adOpenStatic, adLockPessimistic, adCmdTable

    Please notes that you don't have to use single quotes around aspUser_id if
    the
    <primary_key> is defined as integer. Hope this helps.

    Regards,
    kv-



    "Martin H. Berwanger" <martin@hireplanet.com> wrote:
    >
    >I have been using the below code to insert a CLOB into my database. I've

    noticed
    >a long delay before the record is updated. Being that I have to retrieve
    >all the records in this one table and then loop through ever entry before
    >I finally update the record, with the increasing size of this table this
    >isn't a realistic method. Please Help, martin@hireplanet.com
    >
    >Is there anyway to :
    >A - narrow the resultset
    > or
    >B - another way to insert a CLOB
    >
    >Set oRsConn = Server.CreateObject("ADODB.Connection")
    >oRsConn.open "blah", "www_server"
    >Set oRs = Server.CreateObject("ADODB.Recordset")
    >
    >oRs.Open "test", oRsConn, adOpenStatic, adLockPessimistic, adCmdTable
    >If Not oRs.EOF Then
    > oRs.MoveFirst
    > Do Until Trim(oRs.Fields("user_id")) = aspUser_id
    > oRs.MoveNext
    > Loop
    >
    > oRs.Fields("test_text") = aspLargeCharObject
    > oRs.Fields("test_status") = 1
    > oRs.Update
    >End If
    >oRS.Close
    >Set oRS = Nothing



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center