⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guestadd.asp

📁 1.多种查询方式
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%@ LANGUAGE="VBScript"%>
<% 
response.buffer=true
Response.Expires = 0
Response.CacheControl = "Private" 
%>
<%const title="领货人管理 "%>
<html>
<head>
<meta http-equiv="Content-Type"content="text/html; charset=gb_2312-80">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title><%=title%></title>
<script language=javascript>
function GetPy()
{
//alert(document.addsong.gm.value);
var mm=document.guest.user.value;
if (mm!="")
{var ss=py.getpy(mm);
document.guest.py.value=ss;
}
}
</script>
<link rel=stylesheet type=text/css href=../data/forum.css>
</head>
<body topmargin="0" onload="document.guest.code.focus();">
<!-- #include file=../data/username.inc-->
<!-- #include file=../data/connect.asp-->
<!--#include file=../data/myPrg.asp-->
<%
closed = request("closed")
if closed = "" then
	closed = 1
end if
newcompanyid = request("companyid")
if newcompanyid = "" then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert("""+newcompanyid +"请先选择公司再做此步操作!"");"
	Response.write "history.go(-1);"
	Response.Write "</script>"
	Response.End 
elseif not isnumeric(newcompanyid) then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert(""companyid必须为整数!"");history.go(-1);"
	Response.Write "</script>"
	Response.End
else
	newcompanyid = cint(newcompanyid)
end if
arra = split(session("username"),";")
UserCompanyid = arra(0)
flag = arra(1)
User = arra(2)
userno = arra(4)

'on error resume next
'Showtitle(title)
dim curaction, curid, bedit, founderr, errmsg
curaction = request("action")
curid = request("id")
curid = replace(curid,"'","")
'Response.Write curid
bedit = false
founderr = false
if curaction = "edit" then
	bedit = true
end if

dim sql
dim code
code = trim(request("code"))
code = replace(code,"'","’")
city = trim(request("city"))
city = replace(city,"'","’")
py = trim(request("py"))
if py = "" then
	py = " "
else
	py = replace(py,"'","")
end if
'添加记录
if curaction = "newsave" then
	
	if trim(request("user")) = ""  or city = "" then
		call closedatabase
		founderr = true
		response.write "<script language=javascript>"
		Response.Write "alert(""请填写完整的资料!"");history.back();</script>"
		Response.End 
		errmsg = "<p><font color=red>请填写完整的资料!</font></p>"
	end if
	if trim(code) <> "" then
		if isnumeric(code) = false then
			call closedatabase
			Response.Write "<script language=javascript>"
			Response.Write "alert(""领货人编号必须为数字!!!"");history.go(-1);"
			Response.Write "</script>"
			Response.End 
		end if
	else
		code = " "
	end if
	if founderr then
		response.write errmsg
	else
		set rs7=server.CreateObject("ADODB.recordset")
		txttitle = trim(request.form("user"))
		txttitle = replace(txttitle,"'","’")
		sql = "select * from guest where guest_user = '" & txttitle &"' and guest_companyid = "&newcompanyid&""
		rs7.open sql,conn,3,2
		if rs7.eof then
			address = trim(request("address"))
			tel = trim(request("tel"))
			fax = trim(request("fax"))
			idcard = trim(request("idcard"))
			takecode = trim(request("takecode"))
			email = trim(request("email"))
			beizu = trim(request("beizu"))
			'------------------------------------
			'2002-3-11 新增城市和联系人
			
			contact = trim(request("contact"))
			if city = "" then
				city = " "
			else
				city = replace(city,"'","’")
			end if
			if contact = "" then 
				contact = " "
			else
				contact = replace(contact,"'","’")
			end if
			'------------------------------------
			companyid = newcompanyid
			if address = "" then 
				address = " "
			else
				address = replace(address,"'","’")
			end if
			if tel = "" then 
				tel = " "
			else
				tel = replace(tel,"'","’")
			end if
			if fax = "" then 
				fax = " "
			else
				fax = replace(fax,"'","’")
			end if
			if idcard = "" then 
				idcard = " "
			elseif isnumeric(idcard) = false then
				rs7.close
				set rs7 = nothing
				call closedatabase
				Response.Write "<script language=javascript>"
				Response.Write "alert(""证件号号码必须为数字!!!"");history.go(-1);"
				Response.Write "</script>"
				Response.End 
			end if
			if takecode = "" then 
				takecode = " "
			else
				takecode = replace(takecode,"'","’")
			end if
			if email = "" then 
				email = " "
			else
				email = replace(email,"'","’")
			end if
			if beizu = "" then 
				beizu = " "
			else
				beizu = replace(beizu,"'","’")
			end if
			
			flag = 0
			t = date()
			ip = Request.ServerVariables("remote_host")
			sql = "insert into guest(guest_code,guest_user,guest_pycode,guest_address,guest_tel,guest_fax,guest_idcard,guest_takecode,guest_email,guest_addtime,guest_lasttime,guest_companyid,guest_disabled,guest_beizu,guest_city,guest_contact,from_user,guest_flag) values('"&code&"','"&txttitle&"','"&py&"','"&address&"','"&tel&"','"&fax&"','"&idcard&"','"&takecode&"','"&email&"','"&t&"','"&t&"',"&companyid&",0,'"&beizu&"','"&city&"','"&contact&"','"&User&"',1)"
			'Response.Write sql
			conn.execute sql
						
			if err.number <> 0 then
				rs7.close
				set rs7 = nothing
				call closedatabase
				if debug = 1 then
					response.write "无法保存,数据库操作出错:" + err.description
					Response.Write "错误程序:" & Err.Source & "<br>"
				else
					Response.Write "运行出现异常,请稍后再试"
				end if
				Response.End 
			else
				rs7.close
				set rs7 = nothing
				'call closedatabase
				response.write "<script language=javascript>"
				Response.Write "alert(""记录已经添加到数据库!"");"
				if closed <> 0 then
				Response.Write "opener.location.reload();window.close();"
				end if
				Response.Write "</script>"
				'Response.End 
				'response.write "<center>记录已经添加到数据库。</center>"
			end if
		else
			rs7.close
			set rs7 = nothing
			call closedatabase
			response.write "<script language=javascript>"
			Response.Write "alert(""该领货人已经存在!"");history.back();</script>"
			Response.End 
		end if
		
	end if
end if

'保存记录
if curaction = "editsave" then
	if trim(request("user")) = "" or city = "" then
		founderr = true
		call closedatabase
		response.write "<script language=javascript>"
		Response.Write "alert(""请填写完整的资料!"");history.back();</script>"
		Response.End 
		'errmsg = "<p><font color=red>请填写完整的资料!</font></p>"
	end if
	if code <> "" then
		if isnumeric(code) = false then
			call closedatabase
			Response.Write "<script language=javascript>"
			Response.Write "alert(""领货人编号必须为数字!!!"");history.go(-1);"
			Response.Write "</script>"
			Response.End 
		end if
	else
		code = " "
	end if
	if founderr then
		response.write errmsg
	else
		sql = "select guest_companyid from guest where guest_id ="&curid&""
		set rs_guest = conn.execute(sql)
		if cstr(rs_guest("guest_companyid")) = cstr(newcompanyid) then
			set rs7=server.CreateObject("ADODB.recordset")
			txttitle = trim(request.form("user"))
			txttitle = replace(txttitle,"'","''")
			sql = "select * from guest where  guest_user = '" & txttitle &"' and guest_companyid = "&newcompanyid&" and guest_id <> " + curid
			rs7.open sql,conn,3,2
			if  rs7.eof then		
				address = trim(request("address"))
				tel = trim(request("tel"))
				fax = trim(request("fax"))
				idcard = trim(request("idcard"))
				takecode = trim(request("takecode"))
				email = trim(request("email"))
				beizu = trim(request("beizu"))
				if address = "" then 
					address = " "
				else
					address = replace(address,"'","’")
				end if
				if tel = "" then 
					tel = " "
				else
					tel = replace(tel,"'","’")
				end if
				if fax = "" then 
					fax = " "
				else
					fax = replace(fax,"'","’")
				end if
			if idcard = "" then 
				idcard = " "
			elseif isnumeric(idcard) = false then
				rs7.close
				set rs7 = nothing
				call closedatabase
				Response.Write "<script language=javascript>"
				Response.Write "alert(""证件号号码必须为数字!!!"");history.go(-1);"
				Response.Write "</script>"
				Response.End 
			end if
			if takecode = "" then 
				takecode = " "
			else
				takecode = replace(takecode,"'","’")
			end if
			if email = "" then 
				email = " "
			else
				email = replace(email,"'","’")
			end if
			if beizu = "" then 
				beizu = " "
			else
				beizu = replace(beizu,"'","’")
			end if
			'------------------------------------
			'2002-3-11 新增城市和联系人
			city = trim(request("city"))
			contact = trim(request("contact"))
			if city = "" then 
				city = " "
			else
				city = replace(city,"'","’")
			end if
			if contact = "" then 
				contact = " "
			else
				contact = replace(contact,"'","’")
			end if
			'------------------------------------			
			
				t = date()
				sql = "UPDATE guest SET "
				sql = sql + " guest_code= '" & code & "',"
				sql = sql + " guest_user= '" & txttitle & "',"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -