Forum Moderators: open
CREATE procedure users
@USER_ID int
As
Select * from WEB_USERS where USER_ID= @user_id
GO
----
My asp codes
This is a 1.asp page this ok.
<%
Set rs = Server.CreateObject("ADODB.Recordset")
SQL = " SELECT * FROM WEB_USERS "
rs.open SQL,Con
While not rs.eof
%>
<a href="2.asp?kul_id=<%= rs("USER_ID") %>"><%= rs("USER_ID") %> <%= RS("USERNAME") %></a><br>
<%
rs.MoveNext
Wend
%>
This is 2.asp page, i dont know exactly what i do, i think parameter is wrong and bad.
mistake is where it is written "kul_id"
<%
kul_id = request.querystring("kul_id")
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = Con
cmd.CommandText = "users"
cmd.CommandType = 4
cmd.CommandTimeout = 0
cmd.Prepared = true
cmd.Parameters.Append cmd.CreateParameter &_
("@user_id",adVarChar,adParamInput ,10,"kul_id")
cmd.Parameters.Append cmd.CreateParameter &_
("@user_id",adInteger,adParamOutput)
Set rs = cmd.Execute
%>
<%=intNumber = cmd.Parameters ("@user_id") %>
It looks like your problem may be the way your passing kul_id into the stored proc.
When setting kul_id you should type it as an integer (ex. kul_id = CInt(Request.QueryString("kul_id")) )
And then when you pass it into the stored proc, don't pass it in as a text string (i.e. "kul_id") because SQL will think your trying to send in the text "kul_id" when it's expecting an integer. Instead just pass in the variable you created earlier from the query string:
cmd.Parameters.Append cmd.CreateParameter &_
("@user_id",adVarChar,adParamInput ,10,kul_id)
Instead of
cmd.Parameters.Append cmd.CreateParameter &_
("@user_id",adVarChar,adParamInput ,10,"kul_id")
ALSO
In your last line of code, don't refer to the command object for @userid's value. The stored proc is only reading this as an INPUT variable, NOT output. You should refer to the recordset object that you created in the line before and check for the value of user_id (assuming that's the name of a field in your table).
Hope that helps.