Professional Web Applications Themes

Update data via DLL - ASP Database

I have an ASP code like this (in wochange.asp): ========================== <% Set objWO = server.CreateObject("MaxAsp.WoAccess") set rs = objWO.WoStUpdate(request.form("Wonum"), request("Status"), request.form("HiddenID")) set objWO = nothing %> =========================== And I have a DLL file called maxasp.dll The code (in VB) for this maxasp.dll (under WoAccess Class Module), is like this: ================= Public Function WoStUpdate(Wonum As Variant, Status As Variant, ID As Variant) Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset cn.ConnectionString = "driver={SQL Server};server=mysmurf;uid=user;pwd=user1;database =mydb" cn.Open rs.Open "Select * from workorder where wonum=''" & Wonum & "''", cn, adOpenDynamic, adLockOptimistic With rs !Status = Status !statusdate = Now !changeby ...

  1. #1

    Default Update data via DLL

    I have an ASP code like this (in wochange.asp):
    ==========================
    <% Set objWO = server.CreateObject("MaxAsp.WoAccess")
    set rs = objWO.WoStUpdate(request.form("Wonum"), request("Status"), request.form("HiddenID"))
    set objWO = nothing
    %>
    ===========================

    And I have a DLL file called maxasp.dll
    The code (in VB) for this maxasp.dll (under WoAccess Class Module), is like this:
    =================
    Public Function WoStUpdate(Wonum As Variant, Status As Variant, ID As Variant)
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset

    cn.ConnectionString = "driver={SQL Server};server=mysmurf;uid=user;pwd=user1;database =mydb"
    cn.Open
    rs.Open "Select * from workorder where wonum=''" & Wonum & "''", cn, adOpenDynamic, adLockOptimistic

    With rs
    !Status = Status
    !statusdate = Now
    !changeby = ID
    !changedate = Now
    .Update
    End With
    Set rs.ActiveConnection = Nothing
    Set rs = Nothing
    cn.Close
    Set cn = Nothing
    End Function
    ==================

    The problem I am facing is the asp page give me error:
    =================
    Error Type:
    ADODB.Recordset (0x800A0E79)
    Operation is not allowed when the object is open.
    /wochange.asp, line 35
    ==================

    Line 35 is referring to this line in the wochange.asp:
    set rs = objWO.WoStUpdate(request.form("Wonum"), request("Status"), request.form("HiddenID")).

    However, the data is actually updated in the database.

    Does anybody know why I got this error page when the database is actually get updated?

    -----------------------------
    This message is posted by http://asp.forumszone.com

    Ray Guest

  2. #2

    Default Re: Update data via DLL

    What happens when you debug this in your VB editor? I think that's where
    you'll want to work. Perhaps it's the lack of rs.Close before Set
    rs.ActiveConnection = Nothing

    But, let me ask, why are you using a DLL for this at all?

    Ray at work

    "Ray Tang" <com.sg> wrote in message
    news:forumszone.com... 


    Ray Guest

  3. #3

    Default Re: Update data via DLL

    Everything is OK when debuging using VB. Also when using VB code calling
    the same DLL.
    I am using DLL because I want to hide code that interacting with
    database, so I cannot use database access code in the asp itself.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Ray Guest

Similar Threads

  1. Replies: 0
    Last Post: June 1st, 03:15 AM
  2. keep data update
    By jose cardona in forum Macromedia Flash Data Integration
    Replies: 1
    Last Post: April 25th, 11:42 PM
  3. update data on datagrid and DB
    By Grey in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: January 14th, 02:25 PM
  4. update data on form
    By Chris in forum Microsoft Access
    Replies: 3
    Last Post: July 27th, 11:53 AM

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