By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,665 Members | 1,761 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,665 IT Pros & Developers. It's quick & easy.

Get Bad Data from a Recordset Call

P: n/a
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("AccessI D") )

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
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.