289: if request.form("Country") = "other" then
290: SQL = SQL & "国家='" & trim(request.form ("OtherCountry")) & "',"
291: else
292: SQL = SQL & "国家='" & trim(request.form ("Country")) & "',"
293: end if
294: SQL = SQL & "公司地址='" & trim(request.form ("address")) & "',"
295: SQL = SQL & "部门名称='" & trim(request.form ("department")) & "',"
296: SQL = SQL & "公司电话='" & trim(request.form ("telno")) & "',"
297: SQL = SQL & "传真号码='" & trim(request.form ("faxno")) & "',"
298: SQL = SQL & "分机号码='" & trim(request.form ("ext")) & "',"
299: SQL = SQL & "职称='" & trim(request.form ("title")) & "'"
300: SQL = SQL & " where 姓名='" & trim(request.form ("name")) & "'"
301: Set Rs = OBJConn.Execute(SQL)
302: end if
303:
304: ' Send datas to system administrator by E-Mail
305:
306: OBJConn.close
307: SendDatasToAdmin
308: strings = "Request received!\n\nThank you very much!"
309: call showinfo(strings,"",0)
310:
311: end function
14-6-5 写入用户填写的信息
本段程序是在后台执行的程序代码。因此,在执行的过程中,除非出现语法错误出现,否则将不会有画面显示。如希望看到执行的结果,则必须进入SQL Server 2000中查看表的内容。这段程序的执行结果、程序内容及程序说明如下所示:
MoreInfo.asp 程序段
230: <%
231: function WriteProcedures
232: strings = ""
233:
234: if trim(request.form("Country")) = "other" & trim (request.form("OtherCountry")) = "" then
235: strings = strings & "请选择/输入您的国家!\n"
236: end if
237:
238: ' 未输入姓名
239: if trim(request.form("name")) = "" then
240: strings = strings & "Enter your name, Please!\n"
241: end if
242:
243: if strings <> "" then
244: call showinfo(strings,"",0)
245: end if
246:
247: Set OBJConn = Server.CreateObject("ADODB.Connection")
248: OBJConn.Open "Trade", "test", "test1"
249: On Error Resume Next
250:
251: SQL = "Select * from用户基本信息where 姓名='" & trim (request.form("name")) & "'"
252: Set Rs = OBJConn.Execute(SQL)
253: if not rs.eof then
254: Founded = True
255: else
256: Founded = False
257:
258: ' 选择以 E-Mail 方式取得详细资料,但未输入E-Mail 帐号
259: if request.form("GetMethods") = "0" and trim (request.form("email")) = "" then
260: strings = "Enter your E-Mail address, Please!\n"
261: end if
262:
263: ' 选择以寄件方式取得详细资料 , 但未输入地址
264: if request.form("GetMethods") = "1" and trim (request.form("address")) = "" then
265: strings = "Enter your Company Address, Please!\n"
266: end if
267:
268: ' 选择以电话的方式取得联系 , 但未输入电话
269: if request.form("GetMethods") = "2" and trim (request.form("telno")) = "" then
270: strings = "Enter your Telphone Number, Please!\n"
271: end if
272: end if
273:
274: if strings <> "" then
275: call showinfo(strings,"",0)
276: end if
277:
278: ' UserNo <=0 表示数据库中没有该用户的资料
279: if Founded = False then
280: SQL = "Insert into用户基本信息(姓名,性别,电子邮件,公司名称) Values("
281: SQL = SQL & "'" & trim(request.form("name")) & "',"
282: SQL = SQL & "'" & trim(request.form("Gender")) & "',"
283: SQL = SQL & "'" & trim(request.form("email")) & "',"
284: SQL = SQL & "'" & trim (request.form("companyname")) & "'"
285: SQL = SQL & ")"
286: Set Rs = OBJConn.Execute(SQL)
287:
288: SQL = "update用户基本信息set "
289: if request.form("Country") = "other" then
290: SQL = SQL & "国家='" & trim (request.form("OtherCountry")) & "',"
291: else
292: SQL = SQL & "国家='" & trim (request.form("Country")) & "',"
293: end if
294: SQL = SQL & "公司地址='" & trim (request.form ("address")) & "',"
295: SQL = SQL & "部门名称='" & trim (request.form ("department")) & "',"
296: SQL = SQL & "公司电话='" & trim (request.form ("telno")) & "',"
297: SQL = SQL & "传真号码='" & trim (request.form ("faxno")) & "',"
298: SQL = SQL & "分机号码='" & trim (request.form("ext")) & "',"
299: SQL = SQL & "职称='" & trim (request.form("title")) & "'"
300: SQL = SQL & " where 姓名='" & trim (request.form ("name")) & "'"
301: Set Rs = OBJConn.Execute(SQL)
302: end if
303:
304: ' Send datas to system administrator by E-Mail
305:
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页