asp连接access数据例子
<%Dim connstrconnstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Stu.mdb")
Set bb = Server.CreateObject("ADODB.Connection")
bb.Open connstr%>
<html>
<head>
<meta http-equiv="content-Language" content="zh-cn" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Asp+Access读取数据库</title>
</head>
<body>
<%Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * from StuInfo",bb
if rs.eof and rs.bof then
response.Write "数据库中没有数据"
response.End()
end if
response.Write rs("Name")response.Write rs("Sex")
%>
</body>
</html>
相关文档:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="conn.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equi ......
目前,最常用的三种动态网页语言有ASP(Active Server Pages),JSP(Java Server Pages),
PHP (Hypertext Preprocessor)。
简 介
ASP全名Active Server & ......
<%
'以下是试用版代码,是固定的代码,只有正式版才可自动从后台数据库中读取图片。
piao1="images/1.jpg"
piao1url=""
piaos1="图1"
piao2="images/2.jpg"
piao2url=""
piaos2="图2"
piao3="images/ ......
<%
for i=1 to rs.recordCount '变量i从1循环到数据库中的全部记录数
if (i mod 1 =1) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "<tr align='center'>"
end if
%>
此处为要循环的内容
<%if (i mod 1 = 0) then ......
<?php
$connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
$issuetime=date("Y-m-d H:i:s");
$sql="insert into test values("","",...)";
$result=odbc_exec($connid,$sql);
if($result) echo "successful";
else ec ......