⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 启动关闭热启动.html

📁 对于学习很有帮助
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>中华网--科技频道--网络教室--Delphi在网络数据库中的应用</title>
<style type="text/css">
<!--
.text { font-size: 12px; line-height: 160%;font-family: "宋体"}
.text1 { font-size: 12px; text-decoration: none ;line-height:130%;font-family: "宋体"}
.large { font-size: 14.8px;line-height: 160%;font-family: "宋体"}
a { text-decoration: underline}
a:hover { color: #FF6666; text-decoration: none;}
a:visited { color: #336699}
td { font-size: 14.8px; color: #000099;font-family: "宋体"}
-->
</style>
</head>
<body leftmargin="5" topmargin="5" marginwidth="5" marginheight="5"  aLink=#336699 bgColor=#ffffff link=#02029e text=#02029e><table width="760" border="0" cellspacing="0" cellpadding="0" align="center">  <form method="post" action="">    <tr>       <td width="189" rowspan="2" valign="top">         <div align="center"><img src="/zh_cn/etc/images/china_logo1.gif" width="180" height="44" alt="china.com">         </div>        <table width="80" border="0" cellspacing="5" cellpadding="0" align="center" height="24">          <tr>             <td colspan="2" height="2"> <img src="/zh_cn/etc/images/china_logo2.gif" width="137" height="31"></td>          </tr>        </table>      </td>      <td colspan="3" rowspan="2" valign="top">         <div align="right">           <table width="464" border="0" cellpadding="0" cellspacing="2">            <tr>               <td colspan="3" class="text" valign="bottom"   width="20">                 <div align="right"><font       color=#000000><img src="/zh_cn/etc/images/gif.gif" width="18" height="19" border="0"></font></div>              </td>              <td width="435" valign="bottom">                 <div align="left"><a href="http://chat.china.com/"><span class="text1"><font color="#000000">聊天室</font></span></a><span class="text1">&nbsp;<font color="#000000">|</font><a       href="http://searcher.china.com/" class="text1"><font color="#000000"> 搜索引擎</font></a>&nbsp;<font color="#000000">|</font><a       href="http://home4u.china.com/" class="text1"><font color="#000000"> 个人主页</font></a>&nbsp;<font color="#000000">|</font><a       href="http://bbs.china.com/" class="text1"><font color="#000000"> 中华论坛</font></a><font color="#000000">&nbsp;|</font><a href="http://post4u.china.com/" class="text1"><font color="#000000">                   电子杂志</font></a> <font color="#000000">|</font><a href="http://ec.china.com/" class="text1"><font color="#000000">                   电子商务</font></a><font color="#000000"> |</font><a             href="http://freemail.china.com" class="text1"><font color="#000000">                   电子邮件</font></a> </span></div>              </td>            </tr>          </table>          <span class="text"><!-- BEGIN BANNER CODE--> <script language=javascript>var plugNum = Math.random()+1;document.writeln('<A HREF="http://ap.ads.link4ads.com/bin/wadredir?req=clickthru&siteid=4925&pageid='+plugNum+'" target="_blank"><IMG src="http://ap.ads.link4ads.com/bin/wadredir?req=ad&siteid=4925&pageid='+plugNum+'&mode=via" width=468 height=60 Alt="24/7 Asia ad"></A>');</script>          <!-- END BANNER CODE--></span></div>      </td>      <td rowspan="2" width="102" valign="top" align="center"> <span class="text">         <select name="select3" onChange="parent.location.href=this.options[this.selectedIndex].value">          <option>--特色服务--</option>          <option value="http://lovesky.china.com/zh_cn/index.html">缘分的天空</option>          <option value="http://app.china.com/medicine/hospital/php/index.php">网上医院</option>          <option value="http://stock4u.china.com/">在线炒股</option>          <option value="http://job4u.china.com/">网上求职</option>          <option value="http://points4u.china.com/">积分大奖</option>          <option value="http://game.china.com/zh_cn/game/guigu/index.htm">游戏归谷</option>          <option value="http://qf.china.com/">清风围棋</option>          <option value="http://wap4u.china.com">手机上网</option>          <option value="http://download.china.com/">下载基地</option>          <option value="http://desktop.china.com/zh_cn/cool/index.html">桌面壁纸</option>          <option value="http://card.china.com/">电子贺卡</option>          <option value="http://auto.china.com/zh_cn/">汽车世界</option>        </select>        </span>         <table width="85" border="0" cellspacing="0" cellpadding="0">          <tr>             <td class="text">               <div align="center">·<a href="/zh_cn/bbs/index.html" target="_blank">精彩论坛</a><br>·<a href="/zh_cn/chat/index.html" target="_blank">E网情深</a><br>·<a href="/zh_cn/chat/index.html" target="_blank">聊天无限</a>               </div>            </td>          </tr>        </table>      </td>    </tr>    <tr> </tr>  </form></table><table  background="/zh_cn/etc/images/hu.gif" width="676" border="0" cellspacing="0" cellpadding="0" align="center">  <tr valign="bottom">     <td width="52" height="25" >       <div align="center"><a href="http://www.china.com/zh_cn/"><font color="#000000" class="text1">主页</font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://news.china.com/zh_cn/"><font color="#000000" class="text1">新闻</font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://sports.china.com/zh_cn/"><font color="#000000" class="text1">体育</font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://game.china.com/zh_cn/"><font color="#000000" class="text1">游戏</font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://culture.china.com/zh_cn/"><font class="text1" color="#000000">文化</font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://edu.china.com/zh_cn/"><font color="#000000" class="text1">教育</font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://health.china.com/zh_cn/"><font color="#000000" class="text1">健康</font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://finance.china.com/zh_cn/"><font color="#000000" class="text1">财经</font></a></div>    </td>    <td height="25" width="52" background="/zh_cn/etc/images/hu1.gif">       <div align="center"><a href="http://tech.china.com/zh_cn/"><font class="text1"><b><font color="#FFFFFF">科技</font></b></font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://travel.china.com/zh_cn/"><font color="#000000" class="text1">旅游</font></a></div>    </td>    <td height="25" width="52" >       <div align="center"><a href="http://military.china.com/zh_cn/"><font color="#000000" class="text1">军事</font></a></div>    </td>    <td width="52" height="25" >       <div align="center"><a href="http://entertainment.china.com/zh_cn/"><font color="#000000" class="text1">娱乐</font></a></div>    </td>    <td width="52" height="25" >       <div align="center"><a href="http://business.china.com/zh_cn/"><font color="#000000" class="text1">商贸</font></a></div>    </td>  </tr></table>

<body bgcolor="#FFFFFF" leftmargin="5" topmargin="5" marginwidth="5" marginheight="5" link="#02029E" vlink="#336699" alink="#336699" text="#02029E">
 
<table bgcolor="#626BDF" width="755" border="0" cellspacing="0" cellpadding="0" align="center" height="18">
  <tr> 
    <td width="50">&nbsp;</TD>
    <td width="65" class="text"><a href=/zh_cn/news/index.html ><font color="#FFFFFF"> 科技动态 </font></a></TD>
    <td width="65" class="text"><a href=/zh_cn/hardware/index.html ><font color="#FFFFFF"> 硬件广场 </font></a></TD>
    <td width="65" class="text"><a href=http://download.china.com ><font color="#FFFFFF"> 下载基地 </font></a></TD>
    <td width="65" class="text"><a href=/zh_cn/netschool/index.html ><font color="#FFFFFF"><font color='#FFFF00'><b> 网络教室 </b></font></font></a></TD>
    <td width="65" class="text"><a href=/zh_cn/www/index.html ><font color="#FFFFFF"> 网络冲浪 </font></a></TD>
    <td width="65" class="text"><a href=/zh_cn/science/index.html ><font color="#FFFFFF"> 科学博览 </font></a></TD>
    <td width="65" class="text"><a href=/zh_cn/mobile/index.html ><font color="#FFFFFF"> 移动时代 </font></a></TD>
    <td width="65" class="text"><a href=http://wap4u.china.com ><font color="#FFFFFF"> 手机上网 </font></a></TD>
    <td width="65" class="text"><a href=http://desktop.china.com ><font color="#FFFFFF"> 桌面壁纸 </font></a></TD>
    <td width="65" class="text"><a href=http://app.china.com/hitech/market/index.php><font color="#FFFFFF"> 科技商情 </font></a></TD>
    <td width="50" class="text">&nbsp;</TD>
  </tr>
</table>
</TD> 
<table width="755" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td colspan="2" width="600" height="212" align="center" valign="top"> 
      <table border=0 width="550" align="center">
        <tbody> 
        <tr valign="top"> 
          <td> 
            <center class="large">
              <br>
              <table border=0 width=100%><tr><td> 
              <p align="center"><font size=4><b>Delphi在网络数据库中的应用</b></font><br>
                海之水 2001-02-26 11:04:49</p>
              <p><span class=large> <font color="#000000">   <br>  随着Internet的普及和发展,Web成了新的商家必争之地,各家厂商都希望通过Internet技术与最终用户建立直接的联系,比如在Web上向用户推销产品、方便用户在网上查询自己喜欢的商品并提供网上订购服务等,于是产生了CGI(公用网关接口)、ASP等一系列生成动态网页的方法。CGI是最早生成动态网页的方法,几乎所有的WEB服务器都支持它,由于CGI程序是作为独立的外部应用程序来执行的,它要与服务器上的其他程序竞争系统资源,从而降低了服务器运行的效率。另外,使用CGI开发WEB应用时要求程序员不仅要掌握HTML语言,而且还要精通具体的某个编程语言。Delphi是针对CGI效率低的缺点提出来的,它通常以动态链接库的形式出现,是驻留在WEB服务器上的程序,Delphi技术执行程序的效率要大大优于CGI技术,而且开发起来也要相对简单一点。 <br>  Delphi 是具可视化界面的面向对象编程语言,它以其功能强大、简便易用等诸多特性,深受编程人员的欢迎。Delphi 中提供了数据库引擎 BDE(Borland Database Engine),并内含众多的数据库调用构件,为编程人员开发客户/服务器应用程序提供了方便。通常情况下,利用 Delphi 开发数据库应用程序,可以使用TTable、TDataSource、TDBEdit、TDBNavigator等构件。只要正确设置了构件的某些属性,再编写必要的程序代码对一些特定事件进行处理,就能够完成对多种数据库进行的数据处理,例如:记录的输入、修改、删除和查询等。这样做虽然只需要编写极少量的程序代码就能达到很好的效果,但如果在程序设计过程中,某些数据表的结构发生了改变,则必须修改与此数据表有关的所有构件的属性,这将使程序员陷入繁琐的重复劳动中。 <br>  为避免上述的麻烦,我们可以在编写网络数据库应用程序时采用结构化查询语言 SQL(Structured Query Language),这样不仅可以更方便地与诸如 SQL Server、Oracle 等各种后台数据库进行动态的数据交换,而且可以使程序的修改和移植更加灵活。我们以数据输入模块为例,说明开发客户/服务器应用程序时如何采用 SQL 语句实现数据处理功能。首先,判断是否已经有事务处理程序在运行,如果有,将其回卷(rollback);如果没有,则启动一个新的事务,为数据的最终处理做准备。其次,是设置 SQL 语句,并将其写入 TQuery 构件中。最后,将事务提交或回卷,至此完成一条记录的数据输入。 <br>  下面是以页面中的 TEdit 类型编辑框内容作为数据源,向数据库输入记录的过程代码: <br>  procedure DataInsert(const qName:TQuery; <br>  szDBName:string;iNum:Integer; <br>  iMark:array of Integer;eName:array of TEdit); <br>  var <br>  i : Integer; <br>  szSQL : string; <br>  begin <br>  if DataModule1.DataBase1.InTransaction=true then <br>  DataModule1.DataBase1.RollBack; <br>  DataModule1.DataBase1.StartTransaction; <br>  szSQL := ‘INSERT INTO ‘+szDBName+‘ VALUES(‘ <br>  for i:=0 to iNum-1 do <br>  begin <br>  if iMark[i]=0 then <br>  szSQL := szSQL+eName[i].Text {非字符方式} <br>  else <br>  szSQL := szSQL+‘"‘+eName[i].Text+‘"‘; {字符方式} <br>  if i=iNum-1 then <br>  szSQL := szSQL+‘)‘ <br>  else <br>  szSQL := szSQL+‘,‘; <br>  end; <br>  qName.Close; {关闭查询} <br>  qName.SQL.Clear; {清SQL特性内容} <br>  qName.SQL.ADD(szSQL); {添加SQL内容} <br>  szSQL := ‘SELECT * FROM ‘+szDBName; <br>  qName.SQL.ADD(szSQL); <br>  qName.Open; {返回结果集} <br>  DataModule1.DataBase1.Commit; <br>  end; <br><br>  以上过程包含五个参数,实现从页面中的一系列编辑框中读取数据,并向指定数据表输入的功能。其中,参数 qName 为页面中所使用的 TQuery 类构件的名称;参数 szDBName 是数据表的名称;参数eName 是 TEdit 类型的数组,列出了页面中包含数据的各编辑框名称;参数 iNum 是数据表中的字段个数,也即编辑框的个数;参数 iMark 是一个整数类型的数组,该参数表明相应字段是以何种方式输入的,如果是字符方式,需要在数据前后两端加上引号。需要注意的是:在调用本过程之前,应将数据库连接打开: <br>  DataModule1.DataBase1.Connected := true; <br>  过程调用完成后,将数据库连接断开: <br>  DataModule1.DataBase1.Connected := false; <br>  另外,开发网络数据库应用程序时,还可以使用存储过程,即:将预先编译过的 SQL 语句存储在服务器上。存储过程提前运行,且不与程序代码一同存储和编译,因此其对应主程序中的代码相对简洁,运行速度也较快。SQL 语句的集中存放,使其修改更容易。 <br>  要创建向数据表中输入数据的存储过程,代码编写举例如下: <br>  CREATE PROC ProcTest1 <br>  @inttest smallint <br>  ,@strtest char(4) output <br>  AS <br>  INSERT INTO TEST_User.TRANS_TEST <br>  VALUES(@inttest,@strtest) <br>  SELECT @strtest,* FROM TEST_User.TRANS_TEST <br>  以上代码向数据表 TEST_User.TRANS_TEST 添加数据,该数据表包括两个字段:第一个字段为 smallint 类型的数据,参数类型定为 Input(在存储过程中可缺省);第二个字段数据为长度为4 的字符类型,参数类型为 Output。 <br>  其模块程序的编写与 DataInsert 过程相似,区别主要在于模块的中间部分,对应的主要代码如下: <br>  StoredProc1.Close; <br>  {关闭存储过程} <br>  StoredProc1.Params[1].ParamType := ptInput; <br>  {设置存储过程的参数类型} <br>  StoredProc1.Params[1].AsInteger := 1; <br>  {设置存储过程中参数的数据} <br>  StoredProc1.Params[2].ParamType := ptOutput; <br>  StoredProc1.Params[2].AsString := ‘abcd‘; <br>  StoredProc1.Open; {打开存储过程} <br>  其中,StoredProc1 是 TStoredProc 类型的构件名称;Params[1] 是存储过程中的第一个参数,对应存储过程 ProcTest1 可以用ParamByName(‘@inttest‘)代替;存储过程的第二个参数与其类似。 <br>  实际上,编写对网络数据库进行其他数据处理(如:修改、删除和查询等)的模块,与数据的输入模块大体相似,这里就不再赘述了。 
                </font> </span></p>
              <p align="right"></p>
            </center>
          </td>
        </tr>
        </tbody> 
      </table>
      <table align=center border=0 cellpadding=0 cellspacing=0 
              width=540>
        <tbody> 
        <tr> 
          <td colspan="3"> 
            <div align="right"> <font color="#666666"> <a href='http://www.infoweb.com.cn/' target='blank'><img src='/sourceimg/184_inforweb.gif' BORDER='0'  alt='赛迪网'></a></font></div>
          </td>
        </tr>
        </tbody> 
      </table>
      <br>
      <br>
      <table align=center border=0 cellpadding=0 cellspacing=0 
              width=540>
        <tbody> 
        <tr> 
          <td colspan="3"> 
            <div align="center"><font color="#666666"><img src="/zh_cn/images/more.gif" width="16" height="16"><a href='http://app.china.com/editor_sendmail/sendmail.php?topic_link=&topic_title=Delphi在网络数据库中的应用' OnClick="window.open(this.href,'newtxt','top=20,left=100,width=550,height=350,scrollbars=no,resizable=yes');return false;">推荐给朋友</a> 
              <img src="/zh_cn/images/enterbbs.gif" width="19" height="17"><a href="/zh_cn/bbs/index.html" target="_blank">进入BBS</a> 
              <img src="/zh_cn/images/enterchat.gif" width="19" height="19"><a href="/zh_cn/chat/index.html" target="_blank">进入聊天室</a> 
              <img src="/zh_cn/images/close.gif" width="19" height="19"><a href="javascript:window.close();">关闭窗口</a><br>
              </td></tr></table><br>
              </font></div>
          </td>
        </tr>
        </tbody> 
      </table>
      <table class=large align=center border=0 cellpadding=0 cellspacing=0 
              width=550>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -