Study OleReader

xiaoxiao2021-03-06  57

Imports System.DataImports System.Data.Oledb

Public class Webform1 inherits system.web.ui.page

#Region "The code" of the web form designer "

'This call is required for the web form designer. private subinitializecomponent ()

End Sub

'Note: The following placeholders declare are required by the web form designer. 'Don't delete or move it. Private DesignerPlaceHolderDeclaration as System.Object

Private Sub Page_init (Byval E AS System.EventArgs) Handles mybase.init 'Codegen: This method call is required by the Web Form Designer' Do not modify it using the code editor. InitializationComponent () End Sub

#End Region Dim MYCONNECTION As New OleDbConnection ( "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C: /TEST.mdb") Dim MYCOMMAND As New OleDbCommand ( "SELECT * FROM test", MYCONNECTION) Dim MYREADER As OleDbDataReader Private Sub Page_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load mYCONNECTION.Open () mYREADER = mYCOMMAND.ExecuteReader Dim k As Int32 For k = 0 To MYREADER.FieldCount - 1 Response.Write ( MyReader.getname (k)) 'response.write ("
") Next response.write ("
") do while myreader.read fork = 0 to myReader.fieldcount - 1 Response.write (MyReader. Item (k)) Next response.write ("
") loop end sub private sub page_unload () MyReader.close () mycommand.cancel () myConnection.Close () End Subend Class

转载请注明原文地址:https://www.9cbs.com/read-118222.html

New Post(0)