I have not tested this but this will give you general idea
ASP Code Begin
<%
Dim objCmd, objRs, objParam1
' Create an instance of the Command object
Set objCmd = Server.CreateObject("ADODB.Command")
Dim objConn
Set ObjConn = Server.CreateObject("ADODB.Connection")
ObjConn.Open strConnect 'strConnect is your connection string
objCmd.CommandText = "get_Values"
' Set the command Type to the adCmdStoredProc enum value
objCmd.CommandType = adCmdStoredProc
' Create the Parameters
Set objParam1 = objCmd.CreateParameter("@ID", int, adParamInput)
objParam1.Value = 1 ' Your ID value
' Append the Parameters to the Command Object
objCmd.Parameters.Append(objParam1)
' Set the Connection of the Command Object
objCmd.ActiveConnection = objConn
' Execute the Command
Set objRs = objCmd.Execute()
Dim frmField1 = objRs("field1)
Dim frmField2 = ObjRs("field2")
' Clean-up
ObjRs.Close
Set objRs = Nothing
Set objCmd = Nothing
ObjConn.Close
Set ObjConn = Nothing
%>
<HTML>
<head>
</head>
<body>
<table width="100%" >
<tr>
<td>Form Field1</td>
<td><input type="text" name="frmField1" value="<%=frmField1%>"> </td>
</tr>
<tr>
<td>Form Field2</td>
<td><input type="text" name="frmField2" value="<%=frmField2%>"> </td>
</tr>
</table>
</body>
</HTML>
ASP Code End
--SQL Server Stored Procedure
CREATE PRoCEDURE get_VALUES
@ID int
AS
BEGIN
SELECT field1,field2
FROM MyTable
WHERE ID = @ID
END
|