Function cms_html_Vote(Vote_string, voteid)
Dim strsql
If voteid = 0 Then
strsql = "select top 1 * from tblvote order by id desc"
Else
strsql = "select * from tblvote where id = '" & CInt(voteid) & "' order by id desc"
End If
Dim rs_cms_Vote As New ADODB.Recordset
Set rs_cms_Vote = CreateObject("ADODB.Recordset")
rs_cms_Vote.Open strsql, Conn, 1, 1
If Not (rs_cms_Vote.EOF And rs_cms_Vote.BOF) Then
.........
end function
要在工程-引用里加入 Microsoft ActiveX Data Object 2.x Library
Public Conn As New ADODB.Connection
Public rs As New ADODB.Recordset 'Create New Object
Public Function Conn_Open(strSQLServerName, strSQLDBUserName, strSQLDBPassword, strSQLDBName)
Dim strCon As String
Set Conn = New ADODB.Connection
On Error GoTo errhandler:
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
Conn.Open strCon
errhandler:
strError = "错误源:" & Err.Source & vbCrLf & "描述:" & Err.Description
Exit Function
End Function