Check for EOF in ADO.NET

Results 1 to 2 of 2

Thread: Check for EOF in ADO.NET

  1. #1
    Join Date
    Dec 1969

    Default Check for EOF in ADO.NET

    Hi,<BR>In ASP I used to check for EOF by applying:<BR>If Not objRecordSet.EOF Then<BR> ....<BR>End If<BR><BR>How can I do this in ADO.NET using the SqlDataReader ?!<BR><BR>Thank you.<BR><BR>Mazen

  2. #2
    Join Date
    Dec 1969

    Default RE: Check for EOF in ADO.NET

    I hope this example helps:<BR><BR>&#060;%@ Page Language="VB" %&#062;<BR>&#060;%@ Import Namespace="System.Data" %&#062;<BR>&#060;%@ Import Namespace="System.Data.SqlClient" %&#062;<BR>&#060;%<BR>Dim strConnection As SqlConnection<BR>Dim cmdSelectEmployees As SqlCommand<BR>Dim dtrEmployees As SqlDataReader<BR><BR>strConnection = New SqlConnection("server=localhost; database=Northwind; uid=sa; pwd=password;")<BR>strConnection.Open()<BR><BR>cmd SelectEmployees = New SqlCommand("SELECT LastName FROM Employees", strConnection)<BR>dtrEmployees = cmdSelectEmployees.ExecuteReader()<BR>While dtrEmployees.Read()<BR> Response.Write("&#060;li&#062;")<BR> Response.Write(dtrEmployees("LastName"))<BR>End While<BR>dtrEmployees.Close()<BR>strConnection.Clo se()<BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts