%@ Language=VBScript %>
<%
dim con,cmd,rs,sql,constr,resultval,procRs,returnid
constr = "Provider=SQLOLEDB; Data Source=CLIENT1\VSDOTNET2003; Initial Catalog=dvc; User Id=dvc; Password=dvc"
set con = Server.CreateObject("ADODB.Connection")
con.Open constr
set cmd = Server.CreateObject("ADODB.Command")
with cmd
.ActiveConnection = con
.CommandText = "insert_faq"
.CommandType = adCmdStoredProc
.CreateParameter "@question",adVarChar,adParamInput,2000
.CreateParameter "@answer",adVarChar,adParamInput,8000
.CreateParameter "@today",adVarChar,adParamInput,10
.Parameters("@question") = Request("question")
.Parameters("@answer") = Request("answer")
.Parameters("@today") = Now()
.Execute procRs,,adExecuteNoRecords
' Return parameter is stored here
resultval = .Parameters("@RETURN_VALUE")
returnid = .Parameters("@NewId")
End With
set cmd= nothing
con.Close
set con = nothing
If resultval = 0 Then
Response.Write "
Your Record is insertted into the data base
"
Else
Response.Write "There are some problem.
Your Record is not inserted into the database.
"
End If
%>
****************Stored Procedure insert_faq*************************
CREATE PROCEDURE insert_faq
------------------------------------------------------------------------------CREATED BY HIMADRISH LAHA--------------------------------------------------------------------------
------------------------------------------------------------------------------PURPOSE: TO INSERT THE VALUES IN HEALTHGUIDE TABLE----------------------
--@returnval INT OUTPUT,
@question VARCHAR(2000),
@answer VARCHAR (8000),
@today VARCHAR(20),
@NewId VARCHAR (10) OUTPUT
AS
INSERT INTO faq (question,answer, submitdate) values (@question, @answer, @today)
IF @@ERROR <> 0
BEGIN
-- Return 9 to the calling program to indicate failure.
SELECT @NewID =GETDATE()
Return 9
END
ELSE
BEGIN
-- Return 0 to the calling program to indicate success.
SELECT @NewID =GETDATE()
RETURN 0
END
GO