📄 sql server开发技巧-12.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#000000" text="#FFFFFF">
<font color="#009900">Database Update - 用ASP编缉数据库记录 </font>
<p> </p>
<p><%' Defining some constants to make my life easier! (Same as Sample 1 &
2)<br>
' Begin Constant Definition</p>
<p>' DB Configuration constants<br>
' Fake const so we can use the MapPath to make it relative.<br>
' After this, strictly used as if it were a Const.<br>
Dim DB_CONNECTIONSTRING<br>
DB_CONNECTIONSTRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="
& Server.Mappath<br>
("./db_scratch.mdb") & ";"<br>
' We don't use these, but we could if we neeeded to.<br>
'Const DB_USERNAME = "username"<br>
'Const DB_PASSWORD = "password"</p>
<p>'Now we override the above settings to use our SQL server.<br>
'Delete the following line to use the sample Access DB.<br>
DB_CONNECTIONSTRING = Application("SQLConnString") & "UID="
& Application("SQLUsername") <br>
& ";PWD=" & Application("SQLPassword") & ";"</p>
<p>' ADODB Constants<br>
' You can find these in the adovbs.inc file<br>
' Do a search for it and it should turn up somewhere on the server<br>
' If you can't find it you can download our copy from here:<br>
' http://www.asp101.com/samples/download/adovbs.inc<br>
' It may not be the most recent copy so use it at your own risk.<br>
%><br>
<!-- #INCLUDE FILE="adovbs.inc" --><br>
<%<br>
' End Constant Definition<br>
%></p>
<p><%<br>
Dim I ' Standard looping var<br>
Dim iRecordToUpdate ' Id of deleted record</p>
<p>'We're going to keep this as simple as we can.<br>
' 1. Create a Recordset object<br>
' 2. Connect the Recordset to the table<br>
' 3. Find the record to update<br>
' 4. Update the record<br>
' 5. Update the table<br>
' 6. Close the Recordset</p>
<p>'Step 1:<br>
Dim objRecordset<br>
Set objRecordset = Server.CreateObject("ADODB.Recordset")</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -