Classic ASP page to call a SQL2008 stored procedure that returns a recordset and populate an HTML table
$30-250 USD
Σε Εξέλιξη
Αναρτήθηκε περίπου 11 χρόνια πριν
$30-250 USD
Πληρωμή κατά την παράδοση
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 = [login to view URL]("[login to view URL]")
[login to view URL] strConn
Set objCmd = [login to view URL]("[login to view URL]")
[login to view URL] = objConn
dr = 1
strSQL = "select * from dept where DBCOL =" & dr
[login to view URL] = strSQL
set rst = [login to view URL]("[login to view URL]")
[login to view URL] objCmd, , 1, 1
[login to view URL] "" & vbcrlf
if not [login to view URL] and not [login to view URL] then
[login to view URL]
[login to view URL]
if [login to view URL] 0 then
for each X in [login to view URL]
select case [login to view URL]
case "fieldswedontwant"
case else
[login to view URL] "" & [login to view URL] & "" & vbcrlf
end select
next
[login to view URL] "" & vbcrlf
while not [login to view URL]
for each X in [login to view URL]
select case [login to view URL]
case "fieldswedontwant"
case else
[login to view URL] "" & [login to view URL]([login to view URL]).value & " " & vbcrlf
end select
next
[login to view URL] "" & vbcrlf
[login to view URL]
wend
ELSE
[login to view URL] "No Records Found."
end if
end if
[login to view URL] ""
[login to view URL]
set rst = nothing
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