明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

2種沒有使用綁定的 數(shù)據(jù)顯示

[摘要]/*豆腐制作 都是精品http://www.asp888.net 豆腐技術(shù)站如轉(zhuǎn)載 請(qǐng)保留版權(quán)信息 */<%@ Import Namespace="System.Data"...
/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技術(shù)站
如轉(zhuǎn)載 請(qǐng)保留版權(quán)信息
*/
<%@ 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 )
'讀出數(shù)據(jù)的第一種方法
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()
'讀出數(shù)據(jù)的第二種方法
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("再進(jìn)行數(shù)據(jù)庫(kù)open后,我們來顯示這個(gè)Table 的某一個(gè)字段的數(shù)值")
While dtReader.Read()
response.write (dtreader.Item("CustomerId") & "<br>")
End While
End Sub
</script>

<body>
</body>
</html>


作者:豆腐()