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

In Progress

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

Skills: ASP, SQL

See more: calling stored procedure classic asp recordset, classic asp recordset using stored procedure, classic asp stored procedure recordset, call stored procedure recordset classic asp, field name stored procedure classic asp, asp classic stored procedure recordset, asp classic recordset, input html 5, html 5 table, html 5 date, html 5 command, classic asp procedure, stored, html table, eof, database html sql, classic name, Classic ASP, call a, augment, asp sql connection, sql statement stored, table set html, html alter, recordset

Project ID: #4245255

Awarded to:

wontonesaju

hi i am providing my quote for this job. :) i am having 12 years of exp in classic asp. regards saju

$50 USD in 1 day
(51 Reviews)
5.8

3 freelancers are bidding on average $50 for this job

expertcoder1vw

I'm an expert MS-ASP (classic) / MS-SQL Server programmer. I can code the page to output the results as per your requirements. I can complete in 3 days. Quality work, guaranteed results! Bests, Larry

$70 USD in 3 days
(9 Reviews)
4.4
nutanbhosale

we have folks with 15+ years of experience in building web pages in ASP and SQL Server. Ready to start. Thanks - Nutan

$60 USD in 2 days
(6 Reviews)
3.5
mhmsharif1

it's very easy for me ,try to help you....

$40 USD in 2 days
(0 Reviews)
0.0