|
 |
asp_databases thread: Passing Values to Stored Procedure
Message #1 by ulateef@a... on Tue, 27 Feb 2001 12:56:06 +0500
|
|
Hi Everyone Everywhere!
I've created a stored procedure and it works fine when i dont pass any
value to it.
But when i pass any value like @number then it gives following error
ERROR:
Procedure 'ValueInsert2' expects parameter '@n...', which was not
supplied.
Pls give any solution to it.
Umair Latif
Message #2 by "Joe Sabado" <joe.sabado@g...> on Tue, 27 Feb 2001 02:29:26 -0800
|
|
can you include the asp code you're using to call the stored procedure?
----- Original Message -----
From: <ulateef@a...>
To: ASP Databases <asp_databases@p...>
Sent: Tuesday, February 27, 2001 10:30 AM
Subject: [asp_databases] Passing Values to Stored Procedure
>
> Hi Everyone Everywhere!
>
> I've created a stored procedure and it works fine when i dont pass any
> value to it.
> But when i pass any value like @number then it gives following error
>
> ERROR:
> Procedure 'ValueInsert2' expects parameter '@n...', which was not
> supplied.
>
> Pls give any solution to it.
>
> Umair Latif
>
>
>
Message #3 by ulateef@a... on Tue, 27 Feb 2001 16:33:43 +0500
|
|
Here is the page form where I am calling the stored procedure.
<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
On Error Resume Next
Set cmd = CreateObject("ADODB.Command")
Set Conn = CreateObject("ADODB.Connection")
g_connectString = "Provider=SQLOLEDB.1;User ID=sa;Initial
Catalog=temp;Data Source=FGL1"
Conn.ConnectionString = g_connectString
Conn.open
cmd.ActiveConnection = Conn
cmd.CommandText = "Err_Update"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("@Desc", adVarChar,
adParamInput, 20, "Umair")
cmd.Execute
Set cmd = Nothing
Set Conn = Nothing
If Err.Number <> 0 Then Response.Write Err.description & Err.source End
if
conn.close
set cmd = nothing
set conn = nothing
LogError = "<font class=regular><br>There has been an unexpected error
within our application. This error has been logged and our web master has
been notified via e-mail. Please try this functionality
later.<br><br></font>"
%>
</BODY>
</HTML>
Umair Latif
Acrologix (Pvt) Ltd.
106/3, Saint Johns Park
Lahore, Pakistan.
Tel: 92-42-6664301~04 Fax: 6664307
email: ulateef@a...
Message #4 by "Joe Sabado" <joe.sabado@g...> on Tue, 27 Feb 2001 03:58:15 -0800
|
|
can you try replacing this line:
cmd.Parameters.Append cmd.CreateParameter("@Desc", adVarChar,
>adParamInput, 20, "Umair")
with these
cmd.Parameters.Append cmd.CreateParameter ("@Desc", adVarChar, adParamInput,
20)
cmd..Parameters("@Desc") = "Umair"
----- Original Message -----
From: <ulateef@a...>
To: ASP Databases <asp_databases@p...>
Sent: Tuesday, February 27, 2001 3:33 AM
Subject: [asp_databases] Re: Passing Values to Stored Procedure
>
> Here is the page form where I am calling the stored procedure.
>
>
>
> <%@ Language=VBScript %>
> <HTML>
> <HEAD>
> </HEAD>
> <BODY>
> <%
> On Error Resume Next
> Set cmd = CreateObject("ADODB.Command")
> Set Conn = CreateObject("ADODB.Connection")
> g_connectString = "Provider=SQLOLEDB.1;User ID=sa;Initial
> Catalog=temp;Data Source=FGL1"
> Conn.ConnectionString = g_connectString
> Conn.open
> cmd.ActiveConnection = Conn
> cmd.CommandText = "Err_Update"
> cmd.CommandType = adCmdStoredProc
> cmd.Parameters.Append cmd.CreateParameter("@Desc", adVarChar,
> adParamInput, 20, "Umair")
> cmd.Execute
> Set cmd = Nothing
> Set Conn = Nothing
> If Err.Number <> 0 Then Response.Write Err.description & Err.source End
> if
> conn.close
> set cmd = nothing
> set conn = nothing
> LogError = "<font class=regular><br>There has been an unexpected error
> within our application. This error has been logged and our web master has
> been notified via e-mail. Please try this functionality
> later.<br><br></font>"
> %>
> </BODY>
> </HTML>
>
>
> Umair Latif
>
> Acrologix (Pvt) Ltd.
> 106/3, Saint Johns Park
> Lahore, Pakistan.
> Tel: 92-42-6664301~04 Fax: 6664307
> email: ulateef@a...
>
>
>
Message #5 by "JOHN P. PARLATO" <jparlato@m...> on Tue, 27 Feb 2001 06:57:19 -0800
|
|
do not use the @ sign in the ("@Desc",
In the stored procedure it is used but not when you are settiong parms.
Just use "Desc"
-----Original Message-----
From: ulateef@a... [mailto:ulateef@a...]
Sent: Tuesday, February 27, 2001 3:34 AM
To: ASP Databases
Subject: [asp_databases] Re: Passing Values to Stored Procedure
Here is the page form where I am calling the stored procedure.
<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
On Error Resume Next
Set cmd = CreateObject("ADODB.Command")
Set Conn = CreateObject("ADODB.Connection")
g_connectString = "Provider=SQLOLEDB.1;User ID=sa;Initial
Catalog=temp;Data Source=FGL1"
Conn.ConnectionString = g_connectString
Conn.open
cmd.ActiveConnection = Conn
cmd.CommandText = "Err_Update"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("@Desc", adVarChar,
adParamInput, 20, "Umair")
cmd.Execute
Set cmd = Nothing
Set Conn = Nothing
If Err.Number <> 0 Then Response.Write Err.description & Err.source End
if
conn.close
set cmd = nothing
set conn = nothing
LogError = "<font class=regular><br>There has been an unexpected error
within our application. This error has been logged and our web master has
been notified via e-mail. Please try this functionality
later.<br><br></font>"
%>
</BODY>
</HTML>
Umair Latif
Acrologix (Pvt) Ltd.
106/3, Saint Johns Park
Lahore, Pakistan.
Tel: 92-42-6664301~04 Fax: 6664307
email: ulateef@a...
|
|
 |