快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

两种没有使用绑定的 数据显示

/*
豆腐制作 都是精品
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>


作者:豆腐()


返回类别: 教程
上一教程: 微软的远程处理框架.NET Remoting(转天极网)之二
下一教程: 带颜色的listbox控件

您可以阅读与"两种没有使用绑定的 数据显示"相关的教程:
· 在下拉列表框中显示多列的两种简易实现方法
· 使用ADO.NET轻松操纵数据库
· 关于数据绑定在Web页面呈现效果的一点小技巧
· VB.NET中使用FTP下载文件的两种方式
· 使用 ASP+ 列表绑定控件(上)
    微笑服务 优质保证 索取样品