求助,提交数据时判断数据库中是否有同一信息
求助。要求提交数据的时候判断DistrictID与str_DoorNo 字段值是否与数据库中有相同的,有相同的就提示已存在,没有的话就提交上去,求高手帮忙。
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/adovbs.inc"-->
<!--#include file="../inc/functions.asp"-->
<%
Checklogin()
CheckRight()
%>
<%
dim SaleOrRent
SaleOrRent=Request("SaleOrRent")
if SaleOrRent="" then SaleOrRent="Sale"
if SaleOrRent="Sale" then
Tit="出售"
else
Tit="出租"
end if
'response.write SaleOrRent
dim TmpID,Code,RegName,RegSex,RegIDCard,RegPhone,HouseTypeID
dim RegMbPhone,RegDate,DistrictID,Address,DoorNo,IsValid,Audit,PropertyRightID
dim SaleStatus,Endable,RentStatus
IsValid=0
SaleStatus=-1
Endable=-1
if Request("RentStatus")="" then
RentStatus=-1
else
RentStatus=Request("RentStatus")
end if
TmpID=Request("TmpID")
if TmpID="" then TmpID=0
function SaveData(id)
'response.write SaleOrRent
if SaleOrRent="Sale" then
Sql="select * from TmpSale where TmpID='"&id&"'"
else
Sql="select * from TmpRent where TmpID='"&id&"'"
end if
Set RS=Server.CreateObject("ADODB.Recordset")
RS.Open Sql,Conn,1,3
if RS.EOF then
RS.AddNew
if SaleOrRent="Sale" then
RS("TmpId")=GetTmpSaleID(Session("CityID"))
else
RS("TmpId")=GetTmpRentID(Session("CityID"))
end if
end if
RS("HouseTypeID")=Request("str_HouseTypeID")
RS("CityID")=Session("CityID")
RS("Code")=Request("Code")
'RS("HostName")=Request("str_HostName")
'RS("HostSex")=Request("HostSex")
'RS("HostIDCard")=Request("strHostIDCard")
'RS("HostPhone")=Request("strHostPhone")
'RS("HostMbPhone")=Request("HostMbPhone")
RS("RegName")=Request("str_RegName")
RS("RegSex")=Request("RegSex")
RS("RegIDCard")=Request("RegIDCard")
RS("RegPhone")=Request("RegPhone")
RS("RegMbPhone")=Request("str_RegMbPhone")
'RS("RegDate")=Request("dteRegDate")
'RS("tuijian")=Request("tuijian")
RS("DistrictID")=Request("DistrictID")
RS("Address")=Request("strAddress")
RS("DoorNo")=Request("str_DoorNo")
'RS("PropertyRightID")=Request("PropertyRightID")
if SaleOrRent="Sale" then
RS("SaleStatus")=Request("SaleStatus")
'response.write "<font color=red>"&SaleOrRent&"</font>"
else
RS("jiegou")=Request("jiegou")
'RS("jiegou")="TEST"
'response.write request("jiegou")
RS("RentStatus")=Request("RentStatus")
'response.write request("RentStatus")
'response.write "<font color=blue>"&SaleOrRent&"</font>"
end if
RS("UserID")=Request("str_UserID")
RS("DptID")=Session("DptID")
RS("IsValid")=Request("IsValid")
RS("Audit")=Request("Audit")
'RS("Remark")=Request("Remark")
RS(&quo