完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
AddNew 方法范例 (VBScript)
使用 Find 定位文件 Adovbs.inc,并将其放到计划使用的目录中。请将下列代码剪切并粘贴到记事本或其他文本编辑器中,并将其另存为 AddNew.asp。可以在任何客户端浏览器中查看结果。 要执行本范例,请在 HTML 表中添加虚构的新记录。单击“Add New”。要删除不需要的记录,请参阅 Delete 方法范例。 <%@Language = VBScript %> ADO AddNew Method<% src = "C:mssdksamplesdataaccessrdsadvworks.mdb" sC & src 'Create and Open Connection Object Set OBJdbConn = Server.CreateObject("ADODB.Connection") OBJdbConn.Open sConnStr 'Create and Open Recordset Object Set RsCustomerList = Server.CreateObject("ADODB.Recordset") RsCustomerList.ActiveConnection = OBJdbConn RsCustomerList.CursorType = adOpenKeyset RsCustomerList.LockType = adLockOptimistic RsCustomerList.Source = "Customers" RsCustomerList.Open %> If this is first time page is open, Form collection will be empty when data is entered. run AddNew method --> <% If Not IsEmpty(Request.Form) Then If Not Request.Form("CompanyName") = "" Then RsCustomerList.AddNew RsCustomerList("CompanyName") = Request.Form("CompanyName") RsCustomerList("ContactLastName") = Request.Form("LastName") RsCustomerList("ContactFirstName") = Request.Form("FirstName") RsCustomerList("PhoneNumber") = Request.Form("PhoneNumber") RsCustomerList("City") = Request.Form("City") RsCustomerList("StateOrProvince") = Request.Form("State") RsCustomerList.Update RsCustomerList.MoveFirst End If End If %>
<%'Show location of data source Response.Write(OBJdbConn) %>
|
||||
相关推荐 |
||||
只有小组成员才能发言,加入小组>>
12134 浏览 2 评论
4470 浏览 3 评论
3703 浏览 5 评论
9535 浏览 47 评论
4508 浏览 9 评论
709浏览 0评论
510浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 04:10 , Processed in 0.640995 second(s), Total 75, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号