文章分类 | 软件分类 | 最新软件 | 杀毒软件 | 实用软件  | MTV下载  | 设为首页 |
  | 下载分类 | 最近更新
您的位置: 首页 >> 文章首页 >> 技术开发 >> SQL 学院 >> 数据库技巧 >>  
数据库技巧点击TOP10
·sqlserver MSDTC的设置要点2006-2-10 11:41:22
·SQL Server 2000的安全配置2006-2-10 16:18:54
·取得拼音字头的存储过程2006-2-10 12:44:25
·查看SQL Server数据空间分配情况2006-2-10 11:51:12
·SQL安装问题总结2006-2-10 11:41:32
·SQL Server编写存储过程小工具(二)2006-2-10 11:51:14
·Sql server数据库备份还原另一方法2006-2-10 11:51:25
·在IE中直接连接SQL数据库2006-2-10 11:51:25
·ORACLE SQL性能优化系列(九)2006-2-9 18:01:08
·SQL Server编写存储过程小工具(一)2006-2-10 11:51:13
SQL 学院点击TOP10
·使用视图控制用户对数据访问2006-2-9 17:33:51
·ORACLE SQL性能优化系列(四)2006-2-9 18:00:47
·数据库升迁从sqlserver6.5到sqlserver20002006-2-9 17:36:12
·谈数据库中模糊数据的输入与判别2006-2-9 16:02:23
·sqlserver MSDTC的设置要点2006-2-10 11:41:22
·MySQL Join详解2006-2-9 16:57:36
·SQL Server 2000安装和基本框架2006-2-9 17:34:09
·asp实现sql的备份与恢复2006-2-9 9:39:30
·SQL数据操作基础中级62006-2-9 14:32:01
·MySQL怎样处理一个溢出的磁盘2006-2-9 14:56:40

 

在IE中直接连接SQL数据库
作者:我去下载           时间:2006-2-10 11:51:25


使用ODC文档


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

<html>

<head>

<meta http-equiv=Content-Type content="text/x-ms-odc; charset=utf-8">

<meta name=ProgId content=ODC.Table>

<meta name=SourceType content=OLEDB>

<meta name=Catalog content=K0712>

<meta name=Schema content=dbo>

<meta name=Table content="T_Material">

<xml id=docprops></xml><xml id=msodc><odc:OfficeDataConnection

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

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

  <odc:Connection odc:Type="OLEDB">

   <odc:ConnectionString>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</odc:ConnectionString>

 

   <odc:CommandType>Table</odc:CommandType>

 

<odc:CommandText>&quot;K0712&quot;.&quot;dbo&quot;.&quot;ICInventory&quot;</odc:CommandText>

 

  </odc:Connection>

 </odc:OfficeDataConnection>

</xml>

<style>

<!--

    .ODCDataSource

    {

    behavior: url(dataconn.htc);

    }

-->

</style>

</head>

<body onload='init()' scroll=no leftmargin=0 topmargin=0 rightmargin=0 style='border: 0px'>

<table style='border: solid 1px threedface; height: 100%; width: 100%' cellpadding=0 cellspacing=0 width='100%'>

  <tr>

    <td id=tdName style='font-family:arial; font-size:medium; padding: 3px; background-color: threedface'>

      &nbsp;

    </td>

     <td id=tdTableDropdown style='padding: 3px; background-color: threedface; vertical-align: top; padding-bottom: 3px'>

      &nbsp;

    </td>

  </tr>

  <tr>

    <td id=tdDesc colspan='2' style='border-bottom: 1px threedshadow solid; font-family: Arial; font-size: 1pt; padding: 2px; background-color: threedface'>

      &nbsp;

    </td>

  </tr>

  <tr>

    <td colspan='2' style='height: 100%; padding-bottom: 4px; border-top: 1px threedhighlight solid;'>

      <div id='pt' style='height: 100%' class='ODCDataSource'></div>

    </td>

  </tr>

</table>

<script language='javascript'>

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) {

    }

  }

</script>

</body>

</html>


 


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

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

<odc:ConnectionString>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</odc:ConnectionString>

 

   <odc:CommandType>Table</odc:CommandType>

 

<odc:CommandText>&quot;K0712&quot;.&quot;dbo&quot;.&quot;ICInventory&quot;</odc:CommandText>

 

其中,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”

分页:
相关文章:
Copyright© 2005-2006 wqxz.com, All Rights Reserved. 购买虚拟主机请与本站联系