JefB
Programmer
- Dec 29, 2000
- 56
I use the following code to display data from a SQL2000 database in a spreadsheet as an ".asp" page.
<%@ Language=VBScript %>
<%
'Change HTML header to specify Excel's MIME content type
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>
<HTML>
<head>
<title></title>
</head>
<BODY bgcolor="#66FFFF">
Here is the info you requested.<p>
<%
' Create ADO Connection object
dim myConnection
set myConnection = CreateObject("ADODB.Connection"
' Open SQL Server Nationwide database...
myConnection.Open "DSN=nationwide2;UID=homer;Password=doh"
' Get a recordset of info from Airports table...
sqlStr = "exec RoomsByDay_Rollup_SP '6/1/03', '6/13/03'"
set rsAirports = myConnection.Execute(sqlStr)
%>
......
Note that the data comes from a stored procedure: "exec RoomsByDay_Rollup_SP '6/1/03', '6/13/03'"
My question is; how do I feed the two arguments to the stored procedure (currently hard-coded as '6/1/03', '6/13/03') as user suppled variables?
In other words, run as SQL code, the stored procedure is a date-range query and I would like to do the same online. Preferably, I'd feed the variables from a separate "request" page.
Thanks
JefB
<%@ Language=VBScript %>
<%
'Change HTML header to specify Excel's MIME content type
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>
<HTML>
<head>
<title></title>
</head>
<BODY bgcolor="#66FFFF">
Here is the info you requested.<p>
<%
' Create ADO Connection object
dim myConnection
set myConnection = CreateObject("ADODB.Connection"
' Open SQL Server Nationwide database...
myConnection.Open "DSN=nationwide2;UID=homer;Password=doh"
' Get a recordset of info from Airports table...
sqlStr = "exec RoomsByDay_Rollup_SP '6/1/03', '6/13/03'"
set rsAirports = myConnection.Execute(sqlStr)
%>
......
Note that the data comes from a stored procedure: "exec RoomsByDay_Rollup_SP '6/1/03', '6/13/03'"
My question is; how do I feed the two arguments to the stored procedure (currently hard-coded as '6/1/03', '6/13/03') as user suppled variables?
In other words, run as SQL code, the stored procedure is a date-range query and I would like to do the same online. Preferably, I'd feed the variables from a separate "request" page.
Thanks
JefB