阅读文章(首页/程序开发/.NET教程/)

在ASP+中访问数据库

[日期:2004-06-24] 来源:  作者: [字体: ]

In an ASP+ page ,databases can be accessed by employing ADO+ objects. In order to retrieve values from
databases through ADO+ we have to follow certain procedures which are different from those employed in ADO.

The article throws Light on Various steps involved in using ADO+ in an ASP page for retrieving the
database values for an access database.

The datagrid control provided with ASP+ is used for displaying the values retrieved from the database.

First include the language in which the ASP+ page will be coded. This is specified by using Page directive
as shown below. In this example Let us use 'VB' as The language for coding ASP+ Page. The above thing can
be achieved by using the following page directive as shown below.

<%@ Page Language="VB"%>


Next Import the namespaces required for creating the Datasetcommand object and Other ADO objects such as
connection , dataset. This can be done by the following ASP+ statements

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ADO" %>


Next create the script required for accessing the database. In this example let us use a server side
submit control whose onClick triggers The script given below



Finally place the following HTML in the ASP+ code





<ASP:DataGrid id="dtgrid" HeaderStyle-Font-Bold="True" ToolTip="data Grid provided with ASP+"
runat="server" maintainviewstate="false" />


Thats it! The datagrid control in ASP+ page is filled up with the values retrieved from the access
database (database.mdb)

Gopikrishna S
Gopikrishna is a specialist in ASP, MTS ,JavaScript , Vbscript, Windows DNA and VBCom . He is currently
associated with Silverline Technologies Limited Chennai.



阅读:
录入:

评论 】 【 推荐 】 【 打印
上一篇:利用.NET框架简化发布和解决DLL Hell问题(2)
下一篇:利用.NET框架简化发布和解决DLL Hell问题(1)
相关文章      
本文评论
发表评论


点评: 字数
姓名:

  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款