Security Info=False"
End Sub
Private Sub Sql2kConn()
connstr = "driver={SQL server};server="&SqlServer&";uid="&SqlUser&";pwd="&SqlPass&";database="&SqlDbName
End Sub
Private Sub Sql2k05Conn()
connstr="Provider=SQLNCLI.1;Password="&SqlPass&";User ID="&SqlUser&";Initial Catalog="&SqlDbName&";Data Source="&SqlServer
End Sub
Private Sub OpenConn(db_class)
dbclass = db_class
select case db_class
case "access":call AccessConn()
case "sql2000":call Sql2kConn()
case "sql2005":call Sql2k05Conn()
end select
on error resume next
set conn = server.CreateObject("adodb.Connection")
conn.open connstr
if err then
Response.write "数据库链接失败<br>sqlstring = " + connstr
Response.End()
err.clear
end if
End Sub
''**********结束/
查询构造*************
Public Function Select_Table(sql)
if not not isempty(conn) or isnull(conn) then
call OpenConn(dbclass)
elseif conn.state = 0 then
call OpenConn(dbclass)
end if
on error resume next
Set rs = Server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if err then
Select_Table = False
rs.close
exit Function
err.clear
End If
If rs.eof and rs.bof then
rs.close
Select_Table = false
Else
Select_Table = true
End If
readCounts = readCounts + 1
End Function
''分页处理
Public Function Select_page(page,psize)
if isnull(page) or page = "" then page = 1
if page < 1 then page = 1
if rs.state = 1 then
if not rs.eof then
rs.pagesize = psize
rsPage = rs.pagecount
rsCounts = rs.recordcount
if int(page) > Int(rsPage) then page = rsPage
rs.absolutepage = page:nowPage = page