为什么不用ADODB.Connection也可以正常操作数据库?

来源:百度知道 编辑:UC知道 时间:2024/06/24 07:12:26
<%
dim rs_callerRecord
dim str_dataConnection
dim str_sqldataUpdate, str_sqldataRead

set rs_callerRecord = server.createObject("adodb.recordset")

str_dataConnection = "DBQ=" + server.mappath("caller.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
str_sqldataUpdate = "update caller set homeTotal = homeTotal + 1 where runoffID = 1"
str_sqldataRead = "select * from caller where runoffID = 1"

rs_callerRecord.open str_sqldataUpdate, str_dataConnection, 1, 1
rs_callerRecord.open str_sqldataRead, str_dataConnection, 1, 1

'如果数据指针已到结尾
if not rs_callerRecord.eof then
response.write "&total=" & rs_callerRecord("homeTotal") & "&"
else

end if

set rs_callerRecord = nothing
set str_dataConnection = nothing
%>

以上代码并没有使用 Set conn = Server.CreateObject(&q

你这个页面的顶部肯定加载了一个页面,Set conn = Server.CreateObject("ADODB.Connection"),等这些连接数据库的写在一个里面公用总比你每个页面分别写要好吧,不然要是改了密码,你启不是要改很多

键盘上的蛤蟆说的没错,世上没有无缘无故的爱,也没有无缘无故的恨。