连接ACCESS数据库,读取SMS库表
<%dim connDim connstr
dim dbpath
dbpath=“/date.mdb“ ‘数据库地址,相对路径
connstr=“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=“ & Server.MapPath(dbpath)
‘On Error resume next
Set conn = Server.CreateObject(“ADODB.Connection“)
conn.Open connstr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write “Sorry! 主数据库连接出错,请检查连接字串。“
Response.End
End If
读取SMS库表的第8行栏目name文本字段,
set rs=Server.CreateObject(“ADODB.Recordset“)
rsppl=“select * from [sms] where id=8“
rs.open rsppl,conn,1,2
if rs.eof then
Response.Write (“文件出错,请您重新选择<br/>“)
else
Response.Write rs(“name“)&“
‘就这样如果ID=8有内容就会显示,如果没有就会提示
‘文件出错,请您重新选择
end if‘这里就需要写结束语言
如果不懂请您到社区发帖提问%>
发表评论