Home >Database >Mysql Tutorial >在IE中直接连接SQL数据库_MySQL

在IE中直接连接SQL数据库_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 14:05:471343browse

使用ODC文档


使用一个ODC文档可以很轻松在IE浏览器中连接到SQL SERVER数据库的表,ODC文档示例如下:

xmlns:odc="urn:schemas-microsoft-com:office:odc"

xmlns="http://www.w3.org/TR/REC-html40">

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=develop;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=DEVELOP;Use Encryption for Data=False;Tag with column collation when possible=False;Initial Catalog=K0712

Table

"K0712"."dbo"."ICInventory"

 

 

 

function init() {

var sName, sDescription;

var i, j;

try {

sName = unescape(location.href)

i = sName.lastIndexOf(".")

if (i>=0) { sName = sName.substring(1, i); }

i = sName.lastIndexOf("/")

if (i>=0) { sName = sName.substring(i 1, sName.length); }

document.title = sName;

document.getElementById("tdName").innerText = sName;

sDescription = document.getElementById("docprops").innerHTML;

i = sDescription.indexOf("escription>")

if (i>=0) { j = sDescription.indexOf("escription>", i 11); }

if (i>=0 && j >= 0) {

j = sDescription.lastIndexOf("", j);

if (j>=0) {

sDescription = sDescription.substring(i 11, j);

if (sDescription != "") {

document.getElementById("tdDesc").style.fontSize="x-small";

document.getElementById("tdDesc").innerHTML = sDescription;

}

}

}

}

catch(e) {

}

}



这样,可以很方便的在Web页面上显示数据表了J

会Web编程的都知道其实是一个HTML文本,采用Javascript来初始化窗口布局,加粗的部分是数据连接的关键部分,如下所示:

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=develop;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=DEVELOP;Use Encryption for Data=False;Tag with column collation when possible=False;Initial Catalog=K0712

Table

"K0712"."dbo"."ICInventory"

其中,odc:ConnectionString是数据库连接串,使用和ADO一样的格式,不用多说了吧J;odc:CommandType是查询类型,Table是表查询,SQL是标准SQL语句查询;odc:CommandText是查询命令文本,如果是Table类型的,就只要写出表名称就可以了,如master.dbo.sysobjects,如果是SQL类型的话,就是一般的SQL语句,如“SELECT t0.*FROM ICStockBill t0 INNER JOIN ICStockBillEntry t1 ON t0.FStockBillID=t1.FstockBillID ORDER BY t0.FStockBillID”

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn