Closed

Classic ASP page to call a SQL2008 stored procedure that returns a recordset and populate an HTML table

This project was awarded to wontonesaju for $50 USD.

Get free quotes for a project like this
Employer working
Awarded to:
Skills Required
Project Budget
$30 - $250 USD
Total Bids
4
Project Description

For years we have used a block of code to store the results of a SQL select statement in a recordset in Classic ASP, then move through the recordset and built an HTML table with the data.

Now we'd like to do the same with a stored procedure using 1 integer input parameter which was originally used to augment the where clause of the select statement. The page needs to call the stored procedure with the appropriate parameter, and store the resulting recordset in the rst variable so that we can use the existing code to output the field names as headers and cycle through all records building table rows for each.

The stored procedure we're calling is below:

/****** Object: StoredProcedure [dbo].[temp2] Script Date: 02/14/2013 13:27:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[temp2]
@dr int = 33

AS
BEGIN
SET NOCOUNT ON;
select * from dept where DBCOL = @dr
SET NOCOUNT OFF;

END

Our Classic ASP code is along these lines:

'-- Create object and open database
Set objConn = [url removed, login to view]("[url removed, login to view]")
[url removed, login to view] strConn
Set objCmd = [url removed, login to view]("[url removed, login to view]")
[url removed, login to view] = objConn
dr = 1
strSQL = "select * from dept where DBCOL =" & dr
[url removed, login to view] = strSQL
set rst = [url removed, login to view]("[url removed, login to view]")
[url removed, login to view] objCmd, , 1, 1

[url removed, login to view] "" & vbcrlf
if not [url removed, login to view] and not [url removed, login to view] then
[url removed, login to view]
[url removed, login to view]
if [url removed, login to view] 0 then
for each X in [url removed, login to view]
select case [url removed, login to view]
case "fieldswedontwant"
case else
[url removed, login to view] "" & [url removed, login to view] & "" & vbcrlf
end select
next
[url removed, login to view] "" & vbcrlf
while not [url removed, login to view]
for each X in [url removed, login to view]
select case [url removed, login to view]
case "fieldswedontwant"
case else
[url removed, login to view] "" & [url removed, login to view]([url removed, login to view]).value & " " & vbcrlf
end select
next
[url removed, login to view] "" & vbcrlf
[url removed, login to view]
wend
ELSE
[url removed, login to view] "No Records Found."
end if

end if
[url removed, login to view] ""
[url removed, login to view]
set rst = nothing

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online