Database Update - 用ASP编缉数据库记录
<%' Defining some constants to make my life easier! (Same as Sample 1 & 2)
' Begin Constant Definition
' DB Configuration constants
' Fake const so we can use the MapPath to make it relative.
' After this, strictly used as if it were a Const.
Dim DB_CONNECTIONSTRING
DB_CONNECTIONSTRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath
("./db_scratch.mdb") & ";"
' We don't use these, but we could if we neeeded to.
'Const DB_USERNAME = "username"
'Const DB_PASSWORD = "password"
'Now we override the above settings to use our SQL server.
'Delete the following line to use the sample Access DB.
DB_CONNECTIONSTRING = Application("SQLConnString") & "UID=" & Application("SQLUsername")
& ";PWD=" & Application("SQLPassword") & ";"
' ADODB Constants
' You can find these in the adovbs.inc file
' Do a search for it and it should turn up somewhere on the server
' If you can't find it you can download our copy from here:
' http://www.asp101.com/samples/download/adovbs.inc
' It may not be the most recent copy so use it at your own risk.
%>
<!-- #INCLUDE FILE="adovbs.inc" -->
<%
' End Constant Definition
%>
<%
Dim I ' Standard looping var
Dim iRecordToUpdate ' Id of deleted record
'We're going to keep this as simple as we can.
' 1. Create a Recordset object
' 2. Connect the Recordset to the table
' 3. Find the record to update
' 4. Update the record
' 5. Update the table
' 6. Close the Recordset
'Step 1:
Dim objRecordset
Set objRecordset = Server.CreateObject("ADODB.Recordset")
分享到:
相关推荐
ASP和SQL一直深受网站数据库设计人员的喜爱。 本书着重介绍ASP程序设计语言的各种功能及其实际应用, 同时也介绍SQL Server的程序设计技巧。本书将引导读者用ASP语法, 配合数据库系统的开发技巧,构建一个完整的...
2 直接使用ADO与SQL 连接 307 11-2-3 直接与Access MDB 连接 308 11-3 Recordset对象的基础 308 11-3-1 取得字段名称与内容 314 11-3-2 取得、移动记录指针 317 11-3-3 Field对象 320 11-4 ...
1,连接数据库代码 文件名称 conn.asp 所有访问数据库的文件都调用此文件<!--#include file=\"Conn.asp\"--> db=\"data/data.mdb\" \'数据库存放目录 on error resume next set conn=server.createobject(\...
在上面这个程序中我想你展示了如何使用JDBC-ODBC连接数据库,使用SQL语句生成一个表,使用SELECT、INSERT 、UPDATE语句取的、插入和更新一个表中的数据,如何通过字段名和字段索引访问数据库中的东东!我希望你能从...
数据库:SQL Server 2005 Web服务器:IIS5.1 及以上版本 2.本书所附光盘范例 第2章(\C02) 示例描述:本章实现了电子通讯录系统,功能包括用户注册、用户登录、修改密码、添加好友、添加好友联系方式、修改好友...
深田之星Database2Sharp,是一个NHibernate、Castle-ActiveRecord、Enterprise Library和PetShop架构的C#代码和Java代码生成工具,提供了对MS Sql2000、MS Sql2005、Oracle、Mysql、Access的支持;可以生成各种架构...
SQL Server是由Microsoft开发和推广的关系数据库管理系统(DBMS),它最初是由Microsoft、Sybase和Ashton-Tate三家公司共同开发的。SQL Server 2000是Microsoft公司于2000年推出的最新版本。 SQL Server 特点: 1....
1、顾名思义:这个框架主要完成两个功能: (1)实现Object to Database Mapping,开发者再也不用编写复杂的insert, update 和delete了,而且对Oracle, Sql Server以及各种OLEDB数据源支持透明访问。 其中Oracle和Sql ...
1、顾名思义:这个框架主要完成两个功能: (1)实现Object to Database Mapping,开发者再也不用编写复杂的insert, update 和delete了,而且对Oracle, Sql Server以及各种OLEDB数据源支持透明访问。 其中Oracle和Sql ...
OperateXmlDatabase/XmlDatabase.cs 操作XML数据库的组件 OperateSqlServer/DataCommon.cs 操作SQL数据库的公用组件 OperateSqlServer/OperateDatabase.cs 操作SQL数据库的公用组件 Common...
需要注意的是,如果你要用一个IP地址对应多个不同的FTP服务器,则只能用使用不同的端口号的方法来实现,而不支持“主机头名”的做法。 对于已建立好的FTP服务器,在浏览器中访问将使用如“ftp://192.168.0.1”或是...