/*
Tofu is made of excellent products
Http://www.asp888.net bean curd technology station
Retain the copyright information if reprinted.
*/
<% @ 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)
The first method to read data
Dim myConnection as SQLConnection
Dim dtReader AS SQLDataReader
MyConnection = new SQLConnection ("server = localhost; uid = sa; pwd =; database = northwind ")
CustomersDSCommand = new SQLDataSetCommand ("SELECT * FROM MERs", myConnection)
DsCustomer = new DataSet ()
CustomersDSCommand. FillDataSet (dsCustomer, "Customers ")
Dim Customer as DataRow
For Each Customer In dsCustomer. Tables ("MERs"). Rows
Response. Write (Customer ("CustomerId"). ToString () + "<BR> ")
Next
End Sub
Sub displaydata ()
The second Method for Data Reading
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 MERs"
Sqlcmd = New SQLCommand (SQL, sqlserver)
Sqlcmd. ActiveConnection. Open ()
Sql0000.exe cute (dtreader)
Response. write ("after opening the database, we will display the value of a field in this Table ")
While dtReader. Read ()
Response. write (dtreader. Item ("CustomerId") & "<br> ")
End While
End Sub
</Script>
<Body>
</Body>
</Html>
Author: tofu ()