Get Bad Data from a Recordset Call

Discussion in 'ASP General' started by belacyrf, Jul 16, 2004.

  1. belacyrf

    belacyrf Guest

    Here's the code:
    -------------------------------------------------------------------
    accessID = request("accessID")

    strSQL = "SELECT * From PendingAccRequests Where AccessID = "&accessID

    'Create the Recordset object and run SQL statement
    Set accRS = Server.CreateObject ("ADODB.Recordset")
    accRS.Open strSQL, objConn

    If request("confirm") = "yes" then
    strSQL = "Select * From AccessMaster Where RequestID = "&accessID
    'Create the Recordset object and run SQL statement
    Set masterRS = Server.CreateObject ("ADODB.Recordset")
    masterRS.CursorLocation = adUseClient
    masterRS.Open strSQL, objConn,, adLockOptimistic

    masterRS.AddNew
    masterRS("PropownID") = accRS("Bld_Owner_ID")
    masterRS("FileName") = accRS("PROPOWN_Name")
    masterRS("Multiagreement") = False
    masterRS("OpenDate") = Date()
    masterRS("requestID") = accessID
    masterRS.Update

    strSQL = "Select * From Access Where MasterID =
    "&masterRS("MasterID")
    'Create the Recordset object and run SQL statement
    Set newRS = Server.CreateObject ("ADODB.Recordset")
    newRS.CursorLocation = adUseClient
    newRS.Open strSQL, objConn,, adLockOptimistic

    newRS.AddNew
    newRS("Prop_Owner_ID") = accRS("Bld_Owner_ID")
    newRS("Acct_Mgr") = accRS("Assigned")
    newRS("Status") = "OPEN"
    newRS("Source_Date") = accRS("AccessDate")
    If Not IsNull(accRS("ProjID")) then
    newRS("Source_Info") = "SALES REQUEST"
    Else
    newRS("Source_Info") = "CONSTRUCTION"
    End If
    newRS("File_Received") = Date()
    newRS("MasterID") = masterRS("MasterID")
    newRS.Update


    If Not IsNull(accRS("ProjID")) then

    strSQL = "Insert Into AccessBldg (AccessID, BidID) "&_
    "Select "&newRS("AccessID")&", BID_ID from ConstructionBldg Where
    ProjectID = "&accRS("ProjID"))
    objConn.Execute(strSQL)

    strSQL = "Update Building Set Bld_Access_ID =
    "&masterRS("MasterID")&" Where Bld_Address_ID in "&_
    "(Select Bid_ID From ConstructionBldg Where ProjectID =
    "&accRS("ProjID")) &")"
    objConn.Execute(strSQL)
    Else
    strSQL = "Select * From AccessBldg Where AccessID =
    "&accIDRS("AccessID")
    'Create the Recordset object and run SQL statement
    Set accBldRS = Server.CreateObject ("ADODB.Recordset")
    accBldRS.CursorLocation = adUseClient
    accBldRS.Open strSQL, objConn,, adLockOptimistic

    accBldRS.AddNew
    accBldRS("AccessID") = accIDRS("AccessID")
    accBldRS("BidID") = accRS("BidID")
    accBldRS("suite") = accRS("Suite")
    accBldRS.Update

    strSQL = "Select * From Building Where Bld_Address_ID =
    "&accRS("BidID")
    'Create the Recordset object and run SQL statement
    Set bldRS = Server.CreateObject ("ADODB.Recordset")
    bldRS.CursorLocation = adUseClient
    bldRS.Open strSQL, objConn,, adLockOptimistic
    bldRS("Bld_Access_ID") = masterRS("MasterID")
    bldRS.Update
    End If
    strSQL = "Update AccessRequest Set Completed = 1 Where AccessID =
    "&AccessID
    objConn.Execute(strSQL)

    Response.Redirect("handler.asp?id="&newRS("AccessID") )

    End If
    ---------------------------------------------------------------

    Now you'll notice I'm updating and pulling from multiple recordsets.
    Here's the problem.
    PendingAccRequests is a View, and when I run the SQL query (Where
    AccessID = "&accessID), I get good data.
    So I plug it into accRS.
    Now in that row there is a column called projID... it has the number
    477 in it.
    But Anytime I try and call that field (accRS("ProjID")) I get nothing.
    It Will Not return my 477. This is the problem

    Just FYI.
    When I call newRS("AccessID") which is the ident key of the record I'm
    adding, I also get nothing.
    When I call accRS("Assigned") which is filled with the number 47, I
    get nothing.
    When I call masterRS("MasterID") which is another ident field of a
    recordset I'm adding. I get the wrong number. I do not know where the
    number is coming from.

    Can anyone tell me what could be wrong???

    Thanks
     
    belacyrf, Jul 16, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    924
  2. Eric Anderson

    Bad Transform or Bad Engine?

    Eric Anderson, Oct 4, 2005, in forum: XML
    Replies:
    1
    Views:
    397
    Peter Flynn
    Oct 5, 2005
  3. =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=

    vs2005 publish website doing bad things, bad things

    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=, Oct 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    626
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Oct 25, 2006
  4. rantingrick
    Replies:
    44
    Views:
    1,301
    Peter Pearson
    Jul 13, 2010
  5. Hung Huynh
    Replies:
    8
    Views:
    348
    Bob Barrows
    Sep 24, 2003
Loading...

Share This Page