ASP.net 创建 DataReader

OleDbDataReader 类用于从数据源中读取记录流。通过调用 OleDbCommand 对象的 ExecuteReader 方法,就可以创建 DataReader:

<%@ Import Namespace=”System.Data.OleDb” %>

<script runat=”server”>
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection(“Provider=Microsoft.Jet.OLEDB.4.0;
data source=” & server.mappath(“northwind.mdb”))
dbconn.Open()
sql=”SELECT * FROM customers”
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
end sub
</script>

标签