classic ASP and SQL

Discussion in 'Programming' started by Chenks, Mar 12, 2015.

Share This Page

  1. Chenks

    Chenks Registered Trader

    Joined:
    Jan 5, 2002
    Messages:
    3,741
    Likes Received:
    0
    any classic ASP experts here?
    got a page that is pulling records from an SQL database (via a stored procedure). that all works fine.

    however i now need to pull records based on a variable i pass via a querystring (page.asp?ID=blah)

    i can't seem to work out how to pass the parameter to the stored procedure. anyone able to help?

    main page
    Code:
    
    
    
    
    
    
    
    
    	Stock
    
    
    
    
    
    
    	
    		[B]Make[/B]
    		[B]Model[/B]
    	
    
    
    
    	
    		
    		
    	
    	
    
    
    
    
    
    
    
    
    page that holds the common functions that the main page refers to to open database connections
    Code:
     0 Then	
    		Response.Redirect(Page)
    	End If
    End Function
    
    Function Encode(DirtyText)
    	Dim CleanText
    	Cleantext = Server.HtmlEncode(DirtyText)
    	CleanText = Replace(CleanText, "'", "''")
    	CleanText = Replace(CleanText, vbCrLf, "
    ")
    	Encode = CleanText
    End Function
    
    Function mySqlDate(rawDate)
    	Dim dateString
    	dateString = DatePart("yyyy", cdate(rawDate))
    	dateString = dateString & "-" & DatePart("m", cdate(rawDate))
    	dateString = dateString & "-" & DatePart("d", cdate(rawDate))
    	mySqlDate = dateString
    End Function
    
    Function GetMonthName(monthId)
    	Dim monthNames
    	monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
    	GetMonthName = monthNames(monthId -1)
    End Function
    
    Function CheckQueryString(Qstring, QName, Page)
    	If Not Len(QString) = 0 AND Len(QString) < 6 AND IsNumeric(QString) Then
    		QName = QString
    	Else
    		Response.redirect(Page)
    	End If
    End Function
    %>
     
  2. Chenks

    Chenks Registered Trader

    Joined:
    Jan 5, 2002
    Messages:
    3,741
    Likes Received:
    0
    sorted, just in case anyone was reading.
     
  3. Samsonite

    Samsonite Mine's a frosty one

    Joined:
    Oct 28, 2004
    Messages:
    1,025
    Likes Received:
    0
    Nice one - I was about to reply until I scrolled down and saw that you had worked it out :)