Passing Parameters using ADO

Results 1 to 4 of 4

Thread: Passing Parameters using ADO

  1. #1
    Join Date
    Dec 1969
    Posts
    412

    Default Passing Parameters using ADO

    Here&#039s my problem: users log in to our site using their labid. Then we capture their labid using session variables. On the home page, I need to display all of the tickets that are open in that user&#039s lab. Here&#039s some of my code so far: <BR>&#060;%<BR> Dim DbConn<BR> set DbConn = Server.CreateObject("ADODB.Connection")<BR> DbConn.ConnectionString = "DSN=Heat"<BR> DbConn.Open <BR> dim strSQL<BR> strSQL = "SELECT RecvdDate, Status, Desc, CallID, CustID FROM CallLog WHERE CustID= ?" <BR> dim objRS<BR> set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open strSQL, DbConn <BR> %&#062;<BR> How do I specify the parameter in the WHERE clause so users will see tickets from their lab only? I know I need to use the session variable in there somewhere, but I don&#039t know the correct syntax for passing parameters. Thanks for all of your help!

  2. #2
    David Torres Guest

    Default RE: Passing Parameters using ADO

    vLabId = Request("labid")<BR><BR>If the LabID is numeric (int, smallint, etc.)<BR>Then <BR>strSQL = "SELECT RecvdDate, Status, Desc, CallID, CustID FROM CallLog WHERE CustID=" & vLabID<BR><BR>Else if alphanumeric<BR><BR>strSQL = "SELECT RecvdDate, Status, Desc, CallID, CustID FROM CallLog WHERE CustID=&#039" & vLabID & "&#039"<BR><BR>Good Luck<BR>dat

  3. #3
    Join Date
    Dec 1969
    Posts
    412

    Default THANKS!

    Thank you so much for your help, everything worked, and hopefully I&#039ll be able to meet my deadline!<BR><BR>Thanks again.

  4. #4
    Mario Tello Guest

    Default RE: Passing Parameters using ADO

    WHERE CustID= &#039"& Request.Form("Custid")&"&#039"<BR>Obviously you will have to request the variable Custid<BR>with a form from another page with a submit button.<BR><BR>


Posting Permissions

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