/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如转载 请保留版权信息
*/
<%@ import namespace="system.data" %>
<%@ import namespace="system.data.sql" %>
<html>
<script language="vb" runat="server">
dim dscustomer as dataset
dim customersdscommand as sqldatasetcommand
protected sub page_load(src as object, e as eventargs )
'读出数据的第一种方法
dim myconnection as sqlconnection
dim dtreader as sqldatareader
myconnection = new sqlconnection("server=localhost;uid=sa;pwd=;database=northwind")
customersdscommand = new sqldatasetcommand("select * from customers", myconnection)
dscustomer = new dataset()
customersdscommand.filldataset(dscustomer, "customers")
dim customer as datarow
for each customer in dscustomer.tables("customers").rows
response.write(customer("customerid").tostring() + "<br>" )
next
end sub
sub displaydata()
'读出数据的第二种方法
dim dtreader as sqldatareader
dim sqlcmd as sqlcommand
dim sqlserver as string
dim sql as string
sqlserver = "server=localhost;uid=sa;password=;database=northwind"
sql = "select * from customers"
sqlcmd = new sqlcommand(sql,sqlserver)
sqlcmd.activeconnection.open()
sqlcmd.execute(dtreader)
response.write("再进行数据库open后,我们来显示这个table 的某一个字段的数值")
while dtreader.read()
response.write (dtreader.item("customerid") & "<br>")
end while
end sub
</script>
<body>
</body>
</html>
作者:豆腐()
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器