Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pass LoginID field from stored procedure using a link

    I have a stored procedure that selects 3 fields. One of them is called LoginID. I am trying to pass login ID on an asp page through a link but am having trouble getting the login ID to show for the link. The code I have so far doesn't seem to work and I'm not sure what I'm doing wrong:

    Code:
    dim m_rsLoginSettings
    dim m_lngLoginID
    dim m_lngPrintLoginID
    set m_objDataAccess = Server.CreateObject("Login.clsPrintMaterial")
    set m_rsLoginSettings = Server.CreateIbject("ADODB.Recordset")
    
    Set m_rsLoginSettings = m_objDataAccess.getAdors(m_objError, "prLogin_selLoginList", clng(m_lngPrintLoginID))
    
    m_lngPrintLoginID = m_rsLoginSettings("LoginID")
    
    
    Link:
    
     m_strTESystemFormHREF = "https://printedmaterial.trails-end.com/passthru.axd?lid=" & m_lngPrintLoginID
    'm also adding part of the stored procedure
    It's supposed to show the LoginID. That why I'm setting
    m_lngPrintLoginID = m_rsLoginSettings("LoginID"). So when you hover over the link it shows that users LoginID. That is what I'm having trouble passing.

    Here also is part of the stored procedure that calls the select statement where @v_intUserID parameter equals UserID. This statement get the LoginID, Username, and Password by joining Users and Login tables. Both of these tables link together.

    Code:
    SELECT
    
    UserName, [Password], LoginID
    
    FROM vwUser
    
    LEFT JOIN vwLink
    
    ON vwLink.ParentTypeID = 1
    
    AND vwLink.ChildTypeID = 2
    
    AND vwLink.ChildID = vwUser.UserID
    
    INNER JOIN vwLogin
    
    ON vwLink.ParentID = vwLogin.LoginID
    
    WHERE vwUser.UserID = @v_intUserID
    
    ORDER BY vwLogin.Seed DESC

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,664
    Thanks
    80
    Thanked 4,643 Times in 4,605 Posts
    Well, I hope you know that "Login.clsPrintMaterial" is not a standard ActiveX object. I assume it is something your or someone at your company created.

    So given that, it's pretty hard for us to guess whether your call to that getAdors method is doing the right thing, the expected thing, or whatever.

    I would suggest the you need some *HEAVY* debugging.

    I'd start by replacing this line
    Code:
    Set m_rsLoginSettings = m_objDataAccess.getAdors(m_objError, "prLogin_selLoginList", clng(m_lngPrintLoginID))
    with something like this:
    Code:
    Set rs = m_objDataAccess.getAdors(m_objError, "prLogin_selLoginList", clng(m_lngPrintLoginID))
    If rs.EOF Then 
        Response.Write "No data returned from getAdors<hr>"
    Else
        rscnt = 1
        Do Until rs Is Nothing
            Response.Write "<hr/>Recrodset " & rscnt & ":<br/>" & vbNewLine
            For f = 0 To rs.Fields.Count - 1
                Set fld = rs.FIelds(f)
                Response.Write fld.Name & "==" & fld.Value & "<br/>" & vbNewLine
            Next
            rs.MoveNext
            If Not rs.EOF Then Response.Write "...and there are more records<br/>"
            
            Set rs = rs.NextRecordSet
       Loop
    End If
    I think it is possible that what is happening is the the SP is giving you back MULTIPLE recordsets, and perhaps the recordset you need is not the first one.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK here is what I have now but still not able to see the LoginID passed through when I hover over the link in the browser:

    Code:
    dim m_lngLogin
    dim m_lngPassword
    dim m_Username
    dim m_lngUserID
    dim m_lngActorLoginID
    dim m_rsLoginSettings
    dim m_lngLoginID
    dim m_UserID
    dim m_lngPrintLoginID
    dim m_lngBitErrorFound
    set m_objDataAccess = Server.CreateObject("DataAccess.clsNoTransact")
    set m_rsLoginSettings = Server.CreateIbject("ADODB.Recordset")
    Set m_rsLoginSettings = m_objDataAccess.getAdors(m_objError, "prLogin_selLoginList", clng(m_UserID), clng(m_lngBitErrorFound))
    if not funcAreRecordsetAndObjectOK(m_rsLoginSettings,m_objDataAccess,m_strScriptName) then 
    'if error then Display Standard Error Message
         'check modular boolean 
         CALL subManageError(m_blnHasErrorShown) 
         m_blnIsFatalError = True
        m_objDataAccess.Error.ClearError
    else 
    m_lngLogin = m_rsLoginSettings("LoginID") 
    end if
    
    Link:
    
    M_strTESystemFormHREF = "https://printedmaterial.trails-end.com/passthru.axd?lid=" & m_lngLogin
    Last edited by mldardy; 04-13-2012 at 04:30 PM.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,664
    Thanks
    80
    Thanked 4,643 Times in 4,605 Posts
    Can't help you if you won't use my suggestions.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New Coder
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was able to figure this out and it is now working correctly.

    Thanks for your help Old Pedant


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •