I am Beginner in ASP
Problem:I have a table named emp which fields are(id int(4), name
varchar(50), rollNo int(4))
I have to just pass the name of the emp and it will just say that
record is found or Not
My code is :
<%
nm1 = request.form("t xtName")
Set cmd = Server.CreateOb ject("adodb.Com mand")
cmd.ActiveConne ction = con
cmd.CommandText = "sp_search"
cmd.CommandType = adCmdStoredProc
cmd.Parameters. Append cmd.CreateParam eter("nm", adchar, adParamInput)
'Just Above Line no is 19
cmd.Parameters. Append cmd.CreateParam eter("flag",adI nteger,
adParamReturnVa lue)
cmd.execute
x = cmd.Parameters( "flag")
Response.write (x)
y = Cint(x)
if y = 1 then
%>
<script language = "JavaScript ">
alert("Record Found")
</Script>
<%
else
%>
<script language = "JavaScript ">
alert("Record Not Found")
</Script>
<%
end if
%>
My Stored Procedure is
CREATE PROCEDURE sp_search(@nm varchar(50), @flag int output) AS
if exists(select name from emp where name = @nm)
begin
select @flag = 1
return @flag
end
else
begin
select @flag = 0
return @flag
end
GO
My Error is
Error Type:
ADODB.Parameter s (0x800A0E7C)
Parameter object is improperly defined. Inconsistent or incomplete
information was provided.
/vkasp/search_rec.asp, line 19
Problem:I have a table named emp which fields are(id int(4), name
varchar(50), rollNo int(4))
I have to just pass the name of the emp and it will just say that
record is found or Not
My code is :
<%
nm1 = request.form("t xtName")
Set cmd = Server.CreateOb ject("adodb.Com mand")
cmd.ActiveConne ction = con
cmd.CommandText = "sp_search"
cmd.CommandType = adCmdStoredProc
cmd.Parameters. Append cmd.CreateParam eter("nm", adchar, adParamInput)
'Just Above Line no is 19
cmd.Parameters. Append cmd.CreateParam eter("flag",adI nteger,
adParamReturnVa lue)
cmd.execute
x = cmd.Parameters( "flag")
Response.write (x)
y = Cint(x)
if y = 1 then
%>
<script language = "JavaScript ">
alert("Record Found")
</Script>
<%
else
%>
<script language = "JavaScript ">
alert("Record Not Found")
</Script>
<%
end if
%>
My Stored Procedure is
CREATE PROCEDURE sp_search(@nm varchar(50), @flag int output) AS
if exists(select name from emp where name = @nm)
begin
select @flag = 1
return @flag
end
else
begin
select @flag = 0
return @flag
end
GO
My Error is
Error Type:
ADODB.Parameter s (0x800A0E7C)
Parameter object is improperly defined. Inconsistent or incomplete
information was provided.
/vkasp/search_rec.asp, line 19
Comment