📄 custtblupdate.inc
字号:
<%
'on error resume next
Tbl="tbl_Customer"
sSQL="UPDATE tbl_Customer "
sSQL=sSQL & "SET "
sSQL=sSQL & Tbl & ".s_CompanyName='" & s_CompanyName & "'"
if len(s_FirstName)>0 then sSQL=sSQL & "," & Tbl & ".s_FirstName='" & s_FirstName & "'"
if len(s_LastName)>0 then sSQL=sSQL & "," & Tbl & ".s_LastName='" & s_LastName & "'"
if len(s_Phone)>0 then sSQL=sSQL & "," & Tbl & ".s_Phone='" & s_Phone & "'"
if len(s_Address)>0 then sSQL=sSQL & "," & Tbl & ".s_Address='" & s_Address & "'"
if len(s_Address2)>0 then sSQL=sSQL & "," & Tbl & ".s_Address2='" & s_Address2 & "'"
if len(s_City)>0 then sSQL=sSQL & "," & Tbl & ".s_City='" & s_City & "'"
if len(s_State)>0 then sSQL=sSQL & "," & Tbl & ".s_State='" & s_State & "'"
if len(s_Zip)>0 then sSQL=sSQL & "," & Tbl & ".s_Zip='" & s_Zip & "'"
if len(s_Country)>0 then sSQL=sSQL & "," & Tbl & ".s_Country='" & s_Country & "'"
if len(s_Email)>0 then sSQL=sSQL & "," & Tbl & ".s_Email='" & s_Email & "'"
sSQL=sSQL & "," & Tbl & ".y_TaxExempt=" & session("ysnTaxExempt")
sSQL=sSQL & "," & Tbl & ".PrefShipAddressID=1"
sSQL=sSQL & " WHERE (((tbl_Customer.CustomerID)=" & CustomerID & "))"
'response.write sSQL & "<BR>"
conn.execute(sSQL)
if err.number<>0 then
session("err_desc")="Error in custTblUpdate.inc_a<BR>" & err.description
conn.close
set conn=nothing
response.redirect "error_report.asp"
end if
'IS THERE A RECORD IN THE SHIP_TO TABLE?
sSQL="SELECT "
sSQL=sSQL & "CustomerID "
sSQL=sSQL & "FROM tbl_CustomerShipTo "
sSQL=sSQL & "WHERE CustomerID=" & CustomerID
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open sSQL, conn, 3, 3 'read
IF (RS.BOF and RS.EOF) THEN
'NO RECORD... NEED TO INSERT ONE
RS.close
set RS=nothing
sSQL="INSERT INTO tbl_CustomerShipTo ("
sSQL=sSQL & "CustomerID"
sSQL=sSQL & ",ShipID"
if len(s_ShippingFirstName)>0 then sSQL=sSQL & ",s_ShipToFirstName"
if len(s_ShippingLastName)>0 then sSQL=sSQL & ",s_ShipToLastName"
if len(s_ShippingAddress)>0 then sSQL=sSQL & ",s_ShipToAddress"
if len(s_ShippingAddress2)>0 then sSQL=sSQL & ",s_ShipToAddress2"
if len(s_ShippingCity)>0 then sSQL=sSQL & ",s_ShipToCity"
if len(s_ShippingState)>0 then sSQL=sSQL & ",s_ShipToState"
if len(s_ShippingZip)>0 then sSQL=sSQL & ",s_ShipToZip"
if len(s_ShippingCountry)>0 then sSQL=sSQL & ",s_ShipToCountry"
sSQL=sSQL & ",ShipViaID"
sSQL=sSQL & ") Values ("
sSQL=sSQL & CustomerID
sSQL=sSQL & ",1"
if len(s_ShippingFirstName)>0 then sSQL=sSQL & ",'" & s_ShippingFirstName & "'"
if len(s_ShippingLastName)>0 then sSQL=sSQL & ",'" & s_ShippingLastName & "'"
if len(s_ShippingAddress)>0 then sSQL=sSQL & ",'" & s_ShippingAddress & "'"
if len(s_ShippingAddress2)>0 then sSQL=sSQL & ",'" & s_ShippingAddress2 & "'"
if len(s_ShippingCity)>0 then sSQL=sSQL & ",'" & s_ShippingCity & "'"
if len(s_ShippingState)>0 then sSQL=sSQL & ",'" & s_ShippingState & "'"
if len(s_ShippingZip)>0 then sSQL=sSQL & ",'" & s_ShippingZip & "'"
if len(s_ShippingCountry)>0 then sSQL=sSQL & ",'" & s_ShippingCountry & "'"
sSQL=sSQL & "," & ShipViaID
sSQL=sSQL & ")"
ELSE
'YES RECORD... UPDATE
RS.close
set RS=nothing
sSQL="UPDATE tbl_CustomerShipTo "
sSQL=sSQL & "SET "
sSQL=sSQL & Tbl & "ShipTo.s_ShipToLastName='" & s_ShippingLastName & "',"
sSQL=sSQL & Tbl & "ShipTo.s_ShipToFirstName='" & s_ShippingFirstName & "',"
if len(s_ShippingAddress)>0 then sSQL=sSQL & Tbl & "ShipTo.s_ShipToAddress='" & s_ShippingAddress & "',"
if len(s_ShippingAddress2)>0 then sSQL=sSQL & Tbl & ".s_ShipToAddress2='" & s_ShippingAddress2 & "',"
if len(s_ShippingCity)>0 then sSQL=sSQL & Tbl & "ShipTo.s_ShipToCity='" & s_ShippingCity & "',"
if len(s_ShippingState)>0 then sSQL=sSQL & Tbl & "ShipTo.s_ShipToState='" & s_ShippingState & "',"
if len(s_ShippingZip)>0 then sSQL=sSQL & Tbl & "ShipTo.s_ShipToZip='" & s_ShippingZip & "',"
if len(s_ShippingCountry)>0 then sSQL=sSQL & Tbl & "ShipTo.s_ShipToCountry='" & s_ShippingCountry & "',"
sSQL=sSQL & Tbl & "ShipTo.ShipViaID=" & ShipViaID & " "
sSQL=sSQL & "WHERE ((tbl_CustomerShipTo.CustomerID=" & CustomerID & ") AND (tbl_CustomerShipTo.ShipID=1))"
END IF
conn.execute(sSQL)
if err.number<>0 then
session("err_desc")="Error in custTblUpdate.inc_b<BR>" & err.description
conn.close
set conn=nothing
response.redirect "error_report.asp"
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -