<%if Session("weight")=0 then 
Response.Redirect "error.asp?cause=4"
 end if
%>
<object runat=server id=conn1 progid="adodb.connection"></object>
<%application.Lock
conn1.Open Application("p_jyzx")
Application.UnLock
%>
<%
   set rs=server.CreateObject ("ADODB.recordset")
    'rs.Supports (adUpdate)
   
   sql="select * from ideal_friends where user_name='"&session("Current_user")&"'"
   rs.Open sql,conn1,3
  
  if rs.RecordCount>0 then
	set rs1=server.CreateObject ("ADODB.recordset")
   sql="delete * from ideal_friends where user_name='"&session("Current_user")&"'" 
	rs1.open sql,conn1,3,2
	
 end if

	set rs1=server.CreateObject ("ADODB.recordset")
	rs1.Supports (adAddNew)
	sql="select * from ideal_friends"
	rs1.Open sql,conn1,2,3
	rs1.AddNew 
	rs1("user_name")=session("Current_user")
	rs1("relation")=Request("relation")	
	rs1("sex")=Request("sex")	
	rs1("age")=Request("age")	
	rs1("married")=Request("married")	
	rs1("province")=Request("province")	
	rs1("education")=Request("education")	
	rs1("salary")=Request("salary")	
	rs1("height")=Request("height")	
	rs1.Update


conn1.close

	Response.Redirect "ideal_friends.asp"
	
 %> 