最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
用ASP编缉数据库记录
时间:2022-06-30 10:16:57 编辑:袖梨 来源:一聚教程网
' 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.asp*1*0*1.com/samples/download/adovbs.inc
' It may not be the most recent copy so use it at your own risk.
%>
' 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")
'Step 2:
' The syntax for the open command is
' recordset.Open Source, ActiveConnection, CursorType, LockType, Options
' 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.asp*1*0*1.com/samples/download/adovbs.inc
' It may not be the most recent copy so use it at your own risk.
%>
' 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")
'Step 2:
' The syntax for the open command is
' recordset.Open Source, ActiveConnection, CursorType, LockType, Options
相关文章
- 三国志异闻录高速冰冻控制流怎么玩 高速冰冻控制流玩法教学 09-18
- 鸣潮卡提希娅值得抽吗 卡提希娅抽取建议 09-18
- 忘川风华录王安石怎么培养 王安石养成攻略 09-18
- 忘川风华录唐伯虎怎么培养 唐伯虎养成攻略 09-18
- 无限暖暖音乐季她的回旋我的向往任务怎么过 她的回旋我的向往任务攻略 09-18
- 新三国志曹操传南华幻境天境9-2怎么过 南华幻境天境9-2过关攻略 09-18