28,409
社区成员




Dim adconn : set adconn = CreatConn(1, "jell_data_all.mdb", "", "", "")
'response write a ad script by db
Dim rsTopAd : set rsTopAd = GetRecordSet(adconn, "select * from text_ad")
Dim nTopAdCount : nTopAdCount = rsTopAd.RecordCount
<%
Function CreatConn(ByVal strDB, ByVal strServer, ByVal strUid, ByVal strPwd)
On Error Resume Next
Dim TempStr : TempStr = ""
Dim tDb : If Instr(strDB,":")>0 Then : tDb = strDB : Else : tDb = Server.MapPath(strDB) : End If
TempStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&tDb&";Jet OLEDB:Database Password="&strPwd&";"
Dim objConn :Set objConn = nothing
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open TempStr
If Err.number <> 0 Then
objConn.Close
Set objConn = Nothing
End If
Set CreatConn = objConn
End Function
Function CloseConn(ByVal dbConn)
On Error Resume Next
dbConn.Close
Set dbConn = Nothing
End Function
Function GetRecordSet(ByVal dbConn, ByVal strSQL)
On Error Resume Next
Dim rstRecordList
Set rstRecordList=Server.CreateObject("adodb.recordset")
With rstRecordList
.ActiveConnection =dbConn
.CursorType = 3
.LockType = 3
.Source = strSQL
.Open
If Err.number <> 0 Then
.Close
Set rstRecordList = Nothing
End If
End With
Set GetRecordSet = rstRecordList
End Function
Function CloseRecordSet(ByVal Records)
On Error Resume Next
Records.Close
Set Records = Nothing
End Function
%>
'我的代码里没有以下的内容啊
Function GetRecordSet(ByVal dbConn, ByVal strSQL)
''哈哈哈哈哈哈。够狠不.可能出错哦
On error resume next
Set GetRecordSet = dbconn.execute(strSQL)
End Function
Function GetRecordSet(ByVal dbConn, ByVal strSQL)
''哈哈哈哈哈哈。够狠不.可能出错哦
On error resume next
Set GetRecordSet = dbconn.execute(strSQL)
End Function