您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 学习资料 >> 正文
ASP与SQL网站数据库程序设计(15)
作者:.. 文章来源:科学出版社 点击数: 更新时间:2004-1-25 1:03:54
     </td>

151:  </tr>

152:  <tr>

153:     <td class="text02">公司名称</td>

154:     <td colspan="3"><input id=companyname style="width: 380px; height: 22px" size=53 name="companyname"></td>

155:  </tr>

156:  <tr>

157:     <td class="text02">公司地址</td>

158:     <td colspan="3"><input id=address style="width: 380px; height: 22px" size=53 name="address"></td>

159:     </tr>

160:  <tr>

161:     <td class="text02">部门名称</td>

162:    <td><input id=department style="width: 128px; height: 22px" size=18 name="department"></td>

163:     <td class="text01">职称</td>

164:     <td><input id=title style="width: 148px; height: 22px" size=21 name="title"></td>

165:  </tr>

166:  <tr>

167:     <td class="text02">电话:</td>

168:    <td><input id=telno style="width: 143px; height: 22px" size=21 name="telno"></td>

169:     <td class="text02">传真:</td>

170:     <td><input id=faxno style="width: 143px; height: 22px" name="faxno"></td>

171:  </tr>

172:  <tr>

173:     <td class="text02">分机</td>

174:     <td ><input id=ext style="width: 78px; height: 22px" size=11 name="ext"></td>

175:     <td></td>

176:     <td></td>

177:     </tr>

178:  <tr>

179:     <td class="text02">E-Mail</td>

180:     <td colspan="3">

181:        <input id=email style="width: 380px; height: 22px" size=52 name="email">

182:     </td>

183:     </tr>

184:  <tr>

185:  <td>备注</td>

186:  <td colspan=3>

187:  <textarea name=Memo Cols="60" Rows="6" class='document-font'><% = trim(datas(4,i)) %></textarea>

188:  </td>

189:  </tr>

190:  <tr>

191:     <td colspan="4">

192:     <table border=0 cellpadding=0 cellspacing=0 width= "100%" align=center>

193:          <tr>

194:          <td></td>

195:         <td align=right><Input type="submit" Name="Finish-ed" Value="  确定  "></td>

196:          <td width="10%"></td>

197:         <td align=left><Input type="reset" Name="Finished" Value="  清除重填  "></td>

198:          <td></td>

199:  </tr>

200: </table>

14-6-4 存储用户信息

本段程序在执行的过程中,除非有语法错误,否则不会有画面显示。如希望看到执行的结果,必须进入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 & "Enter your Country, Please!\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("company-name")) & "'"

285:         SQL = SQL & ")"

286:         Set Rs = OBJConn.Execute(SQL)

287:

288:         SQL = "update 用户基本信息

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |