惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Jina AI
Jina AI
WordPress大学
WordPress大学
Recent Announcements
Recent Announcements
G
Google Developers Blog
I
InfoQ
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Check Point Blog
J
Java Code Geeks
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
MongoDB | Blog
MongoDB | Blog
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
量子位
A
About on SuperTechFans
D
DataBreaches.Net
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

博客园 - 天龙

ASP.NET 中关于 Async 和 Await 的概述 WIN2003的IIS6调试ASP出现HTTP 500 - 内部服务器错误 SEO 工具集合 去除网页FLASH"单击并激活此控件"解决办法 - 天龙 - 博客园 SQL远程备份 - 天龙 - 博客园 Web Service测试工具小汇 [转]用一个JS代码实现页面刷新后保持页面滚动条的位置 - 天龙 - 博客园 删除SQL 日志 关于net2.0里面新出现的类backgroundworker的应用 使用CHARINDEX函数提高查询速度 如果为网站生成自签名SSL证书 利用html设计滚动的文字 - 天龙 - 博客园 使IIS支持HTTPS/SSL A scrollable panel retaining its scroll position across postbacks. - 天龙 google搜索参数 SQL2分查找法通用分页存储过程算法 五种提高SQL Server性能的方法 解析Atlas—微软的Ajax工具包 在ASP.NET 2.0工程中加入Atlas
纯HTML也能访问数据库 - 天龙 - 博客园
天龙 · 2007-01-12 · via 博客园 - 天龙

Client.Html页面源码如下:

<html>
<head>
<title>get data from database at client</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<style type="text/css">
<!--
body
{font-family:Times New Roman;font-size:9pt;}
table
{font-family:Times New Roman;font-size:9pt;}
button
{color:blue;}
//-->
</style>
<script language="Javascript">
<!--
function connectDB()
{
try{
var count
=0;
var conn
=new ActiveXObject("ADODB.Connection");
var rs
=new ActiveXObject("ADODB.Recordset");
var connectString
="provider=sqloledb.1;user id=sa;password=;data source=coolbug;Initial Catalog=pubs";
var selectString
="select top 5 * from sales";
var tableString
="";

conn.open(connectString);
rs
=conn.execute(selectString);
while(!rs.EOF)
{
if(count++==0)
{
tableString
+="<table border='1'><tr><td>"+rs(0).name+"</td>";
tableString
+="<td>"+rs(1).name+"</td></tr>";
}

tableString
+="<tr><td>"+rs(0).value+"</td>";
tableString
+="<td>"+rs(1).value+"</td></tr>";
rs.moveNext();
}

tableString
+="</table><br>";
document.getElementById(
"dataArea").innerHTML=tableString;
rs.close();
conn.close;
}

catch(e)
{
document.write(e.toString());
}

}

//-->
</script>
</head>
<body>
<div id="dataArea"></div>
<button onclick="connectDB();">retrieve data</button>
</body>
</html>

 
如果要访问别的数据库,就请修改,连接方式。
希望此次抛砖,能引玉。