Advertisement

[x]
Attachment Details

Why is 'If reader1.HasRows = False Then Stop' the Boolean Value doesn't get updated after Reader.Read

[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.5
reader1.read sucessfully reads ea row created with the OLESelect Statement, in the Code Loop.

However, when the last reader1 row is returned/read, the reader1.HasRows BOOLEAN Value shows 'TRUE'.  Then instead of STOP line of being executed, in the Code,  the next line of code abends w the error msg: Invalid Operations Exception was unhandled: No data exists for row/column.

I have also tried to use the boolean reader1.NextResults = False, to detect an EOF/NO ROWS, however the circumstance occurs.  boolean value says 'TRUE', when the next reader1 process/ethod will cause a program exception w same error.

My specific questions, is how can I determine/detect when the last row in reader1 has been reached in the code logic.

A side questions, is how can I specifically see what reader.read record values and what the row/record #/postion in the dataset is, using VB.NET IDE.  Specifically, when I look at the 'locals' pane for information on reader1.  I get all sorts of Field Properties???, such as DEPTH/FIELD COUNT/IsClosed/ITEM ect ect.  But if I expand a specific Field, I can't find any specific useful detail?  Such as how many records are in the reader buffer, which record in the buffer, is  the active record?  Or how to display the record/row information in the IMMEDIATE pane of the IDE.  For instance '?reader1.read'  to display current active row/record or ?reader1.count.

Any assistance, wil be sincerely appreciated.  Thanks

Mike
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
ConTble.Open()
        ConTbleR1.Open()
        'Debug.Print(ConTble.State)
 
        Dim OLESelect As String = "SELECT [NISADDRBK#], ENAME, NMNTH1, TMNTH1, NMNTH2, TMNTH2 FROM TMECrdRecs"
 
        Dim OLECmndR1 As OleDb.OleDbCommand = ConTble.CreateCommand()
        OLECmndR1.CommandText = OLESelect
        Dim OLECmnd As OleDb.OleDbCommand = ConTble.CreateCommand()
        OLECmnd.CommandText = OLESelect
 
        Dim reader1 As OleDb.OleDbDataReader
        reader1 = OLECmndR1.ExecuteReader
        reader1.Read()
        strNISnum = reader1("NISADDRBK#").ToString
        strNISnameVal = reader1("ENAME").ToString
        strNISnumVal = strNISnum
 
        lstTMERecKeys.Add(strNISnum, strNISnameVal)
        lstTMERecVals.Add(strNISnameVal, strNISnum)
 
        While reader1.HasRows
 
            If strNISnumVal <> strNISnum Then
                lstTMERecKeys.Add(strRecKey, strRecVal)
                lstTMERecVals.Add(strRecVal, strRecKey)
                strNISnumVal = strNISnum
            Else
                Do While strNISnum = strNISnumVal And reader1.HasRows
 
                    If reader1.HasRows = False Then Stop
 
                    initRec = reader1("NISADDRBK#").ToString & " " & reader1("ENAME").ToString
                    strRecKey = reader1("NISADDRBK#").ToString
                    strRecVal = reader1("ENAME").ToString
                    strNISnum = reader1("NISADDRBK#").ToString
                    If reader1.HasRows Then reader1.Read()
                    If reader1.HasRows = False Then Stop
 
                Loop
            End If
        End While
Related Solutions
Related Solutions
 
Loading Advertisement...
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 

Rank: Master

Expert Comment by naspinski:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 

Rank: Master

Expert Comment by naspinski:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by mhotto:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 

Rank: Master

Expert Comment by naspinski:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 

Rank: Master

Expert Comment by naspinski:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by mhotto:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by mhotto:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Accepted Solution by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by mhotto:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by mhotto:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by mhotto:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by mhotto:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by CMYScott:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
Loading Advertisement...
20080924-EE-VQP-41 / EE_QW_2_20070628