您的位置:首页 > 编程语言 > ASP

asp问题,请求帮助,急。。。。。

2005-05-31 08:30 246 查看
就是交友网站,看一般的交友网站都会有加把会员加为好友,设黑名单这种的,我的问题是通过调用了一个存储过程,获得了想加好友的那个的id号,怎么才能把调用的id号存到数据库里呀
<a href="addfirend.asp?idh=<%=rs1("userid")%>">加为好友</a>

这个是z1.asp
<!--#include file="ADOVBS.INC"-->
<!--#include file=conn1.asp-->
<%
idhm=request("idh")
dim rs1
dim strsql
set rs1=server.CreateObject("ADODB.recordset")
strsql="exec proc_GetUserinfo1 '"+idhm+"'"
rs1.open strsql,conn1,1,3
'while not rs1.eof  
firendid=idhm
response.write firendid
rs1.addnew
rs1("firendid")=firendid

%>
这是web_addfirend存储过程
/*
添加好友
*/
CREATE PROCEDURE web_Addfirend
@userID char(6),
@firendID char(6)

AS
declare @xh as int
declare @mark as int

select @xh=xh from web_firendinfo where userid=@userid and firendid=@firendid
if @@rowcount=1
begin
if @mark=1 return

if @mark=0 update web_firendinfo set mark=1 where xh=@xh
return
end
insert into web_firendinfo (userid,firendid) values(@userid,@firendid)
GO
这是调用的文件addfirend.asp
<!--#include file=conn1.asp-->
<!--#include file=z1.asp-->

<%
userid=request.Cookies("userid")
hyid1=request("hyid1")
set rs1=server.CreateObject("adodb.recordset")
rs1.Open "exec web_Addfirend '"+userid+"','"+firendid1+"'",conn1
%>

这个是获取id的存储过程,也许是这个过程的问题,可以改改~~~
CREATE PROCEDURE proc_GetUserInfo1
@userID char(6)

AS
declare @dh char(12)
declare @hjbh char(5)
declare @id char(13)
declare @name varchar(30)
declare @sex as int   ---1--man   2--fenman
declare @age as int
declare @high as int   --身高
declare @nickname varchar(20) --昵称
declare @knowlege as int   --学历
declare @love varchar(100)   --爱好
declare @occupation int   --职业
declare @marrayhistory as int
declare @photopath varchar(200)
declare @type as int
declare @con_high as int
declare @con_age as int
declare @con_knowledge as int
declare @secrecylevel as int
declare @sheng varchar(30)
declare @shi varchar(30)
declare @temp varchar(20)
declare @path varchar(200)
set @temp=ltrim(rtrim(@hjbh))+ltrim(rtrim(@id))
select   @name=uname,@nickname=nickname,@sex=sex,@age=age,@high=high,@type = memlevel
    ,@knowlege=knowledge,@love=love,@occupation=occupation,@marrayhistory=marryhistory
    ,@photopath=photopath,@con_high=con_high,@con_age=con_age,@con_knowledge=con_knowledge
    ,@secrecyLevel =secrecyLevel,@sheng = sheng,@shi=shi,@temp=code ,@dh=telnumber,@path=path
    from base_userinfo where userId=@userID and (mark=1 or mark=0)
if @@rowcount=1
begin
 
select @name as xm,@nickname as nc,@sex xb,@age nl,@high sg,@knowlege xl,@love ah,@occupation zy,@marrayhistory hs,
    @photopath zp,@con_high tsg,@con_age tnl,@con_knowledge txl,@secrecyLevel aqjb,@type jb,@sheng sheng,@shi shi,@temp code,@dh dh,@path path
end
GO

大家有没有别的方法可以取id,然后加到数据库中,在asp中我用的是sql数据库,用的是存储过程,别的方法也可以,谢谢大家了,非常急!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息