网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > SQL技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
本月文章推荐
.调整SQLServer2000运行中数据库结.
.SQL SERVER数据库开发之存储过程.
.讲解InfoPlus与Uniformance PHD的.
.SQL server如何定时执行一些脚本.
.生成50万条记录的大数据表的TSQL.
.crosscheck长时间运行后未见结果.
.建立一个传表名参数的存储过程.
.ASE锁模式:AllPages DataPages .
.Sql数据库MDF数据文件数据库恢复.
.精讲sql server数据库备份多种方.
.讲解数据库中行级转换成列级的实.
.把SQL数据库部署到远程数据库服务.
.在SQL Server 2005数据库中实现自.
.一些在SQL帮助中找不到的系统存储.
.滥用触发器会造成数据库及应用程.
.TOPN 子句与SET ROWCOUNTN 之对比 .
.如何得到当前所在的sql的数据库名.
.轻松掌握密码有效性验证失败的处.
.DBA创建用户帐户及分配特定特权的.
.如何修改Syabse服务器端的默认字.

在IE中直接连接SQL数据库

发表日期:2005-7-20


使用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”

上一篇:SQL Server编写存储过程小工具(三) 人气:11809
下一篇:Sql server数据库备份还原另一方法 人气:20087
浏览全部数据库的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐