请根据情况配置StrServer,StrUid,StrSapwd,StrDbName四个参数
Dim StrServer,StrUid,StrSaPwd,StrDbName
StrServer="(local)" '数据库服务器名
StrUid="testuser" '您的登录帐号
StrSaPwd="12345" '您的登录密码
StrDbName="db_test_com" '您的数据库名称
Dim Conn '数据库连接
Dim StrDSN '数据库连接字符串
Dim Rs '命令字符串
StrDSN="driver={SQL server};server="&StrServer&";uid="&StrUid&";pwd="&StrSaPwd&";database="&StrDbName
'建立和数据库master的连接
set Conn = Server.CreateObject("ADODB.Connection")
set Rs=Server.CreateObject("ADODB.RecordSet")
Conn.Open StrDSN
====================================================================================
<%
dim conn,connstr
on error resume next
connstr="DBQ="+server.mappath("data/nxnews.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set conn=Server.CreateObject("ADODB.CONNECTION")
conn.open connstr
%>
<!--#Include File="sql/Neeao_SqlIn.Asp"-->
====================================================================================
<!--#include file =include/jzjc_conn.asp -->
<html>
<head>
</head>
<body>
<STYLE type="text/css">
<!--
a:link {text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited {text-decoration: none; color: #000000 }
A:hover {COLOR: green; FONT-FAMILY: "宋体,MingLiU"; TEXT-DECORATION: underline}
body {font-size: 9pt; font-family: 宋体,MingLiU, Arial;color: #000000}
TD {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000;line-height: 120%;table-layout:fixed;word-break:break-all}
p {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
input {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
body {margin-top: 0; margin-bottom: 0;margin-left:0;margin-right:0; color: #000000}
select {FONT-SIZE: 9PT;font-family: 宋体}
option {FONT-SIZE: 9pt;font-family: 宋体}
textarea {FONT-SIZE: 9pt;font-family: 宋体}
-->
</STYLE>
<%
'ON ERROR RESUME NEXT
ClassId=trim(request("ClassId"))
w=trim(Request("w"))
h=trim(Request("h"))
TitleMaxLen=trim(Request("TitleMaxLen"))
if w="" then w=200
if h="" then h=160
if n="" then n=29
TitleMaxLen=int(TitleMaxLen)
path="/jzjcNewsAsp/"
function titleb(str,strlen)
dim l,t,c, i
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
titleb=left(str,i)&"…"
exit for
else
titleb=str&""
end if
next
end function
function qxalttu(nr)
nr=trim(nr)
nr=replace(nr,"ALT","alt")
nr=replace(nr,"ALT","alt")
nr=replace(nr,"ALT","alt")
nr=replace(nr,"ALT","alt")
nr=replace(nr,"ALT","alt")
if instr(nr," ")<>0 then
aaa=split(nr," ")
nr=aaa(0)
end if
qxalttu=nr
end function
function titlepic(nr)
nr=trim(nr)
nr=replace(nr," ","")
nr=replace(nr,"""","")
titlepic=titleb(nr,n)
end function
set rs = server.CreateObject ("adodb.recordset")
sql = "select top 6 aId,aTitle,aPicUrl from jzjc_Article where aPicUrl<>''"
if ClassId<>"" then
sql=sql&"and (aClass1='"&ClassId&"' or aClass2='"&ClassId&"' or aClass3='"&ClassId&"' )"
end if
sql=sql&"order by aId desc"
rs.open sql,conn,1,1
if rs.recordcount=0 then
Response.Write "<BR><center>无图片信息</center>"
rs.close:set rs=nothing
conn.close:set conn=nothing
Response.end
end if
for i=1 to rs.recordcount
pic1=qxalttu(rs("aPicUrl"))
title1=titleb(rs("aTitle"),TitleMaxLen)
id1=rs("aId")
rs.movenext
if rs.eof then exit for
pic2=qxalttu(rs("aPicUrl"))
title2=titleb(rs("aTitle"),TitleMaxLen)
id2=rs("aId")
rs.movenext
if rs.eof then exit for
pic3=qxalttu(rs("aPicUrl"))
title3=titleb(rs("aTitle"),TitleMaxLen)
id3=rs("aId")
rs.movenext
if rs.eof then exit for
pic4=qxalttu(rs("aPicUrl"))
title4=titleb(rs("aTitle"),TitleMaxLen)
id4=rs("aId")
rs.movenext
if rs.eof then exit for
pic5=qxalttu(rs("aPicUrl"))
title5=titleb(rs("aTitle"),TitleMaxLen)
id5=rs("aId")
rs.movenext
if rs.eof then exit for
pic6=qxalttu(rs("aPicUrl"))
title6=titleb(rs("aTitle"),TitleMaxLen)
id6=rs("aId")
rs.movenext
if rs.eof then exit for
next
rs.close
set rs=nothing
%>
<a target=_blank href="javascript:goUrl()">
<span class="f14b">
<script type="text/javascript">
imgUrl1="<%=pic1%>";
imgtext1="<%=title1%>";
imgLink1=escape("<%=path%>jzjc_NewsShow.asp?NewsId=<%=id1%>");
imgUrl2="<%=pic2%>";
imgtext2="<%=title2%>";
imgLink2=escape("<%=path%>jzjc_NewsShow.asp?NewsId=<%=id2%>");
imgUrl3="<%=pic3%>";
imgtext3="<%=title3%>";
imgLink3=escape("<%=path%>jzjc_NewsShow.asp?NewsId=<%=id3%>");
imgUrl4="<%=pic4%>";
imgtext4="<%=title4%>";
imgLink4=escape("<%=path%>jzjc_NewsShow.asp?NewsId=<%=id4%>");
imgUrl5="<%=pic5%>";
imgtext5="<%=title5%>";
imgLink5=escape("<%=path%>jzjc_NewsShow.asp?NewsId=<%=id5%>");
imgUrl6="<%=pic6%>";
imgtext6="<%=title6%>";
imgLink6=escape("<%=path%>jzjc_NewsShow.asp?NewsId=<%=id6%>");
var focus_width=<%=w%>
var focus_height=<%=h%>
var text_height=18
var swf_height = focus_height+text_height
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5+"|"+imgUrl6
var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5+"|"+imgLink6
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5+"|"+imgtext6
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="pic/playswf.swf"><param name=wmode value=transparent><param name="quality" value="high">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="pic/playswf.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#DADADA" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');
//-->
</script>
</span></a><span id=focustext class=f14b> </span>
<body>
</body>
</html>