Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 20th, 2008, 12:13 PM
Authorized User
Points: 406, Level: 7
Points: 406, Level: 7 Points: 406, Level: 7 Points: 406, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2005
Location: Florida
Posts: 88
Thanks: 4
Thanked 0 Times in 0 Posts
Default No data exists for row/column

I am using the examples in the book as an example to fit specific situations that I am working on using Visual Basic 2008.

In chapter 7 the ListView works perfectly and gives me what I want. When I select a specific record to view I get the "No data exists for row/column" error. My code in the ListView click event looks like this:

 'Initialize a new instance of the databas class...
 Using objData As New WDABase
 Try
   'get the specific record selected in the ListView control...
   objData.SQL = "usp_SelectAnEmployee"
   objData.InitializeCommand()
   objData.AddParameter("@DisplayName", Data.OleDb.OleDbType.Char, _
      50, lstvStaff.SelectedItems.Item(0).Text)
   objData.OpenConnection()
   objData.DataReader = objData.Command.ExecuteReader
   'See if any data exists before continuing...
      If objData.DataReader.HasRows Then
         objData.DataReader.Read()
        'Read the first and onlyrow of data...
         objData.DataReader.Read()
        'Clear prior values...
         ClearAll()
        'Populate the staff data controls...
        >txtDisplayName.Text = objData.DataReader.Item("DisplayName")
         txtFName.Text = objData.DataReader.Item("FName").ToString
         txtLName.Text = objData.DataReader.Item("LName").ToString
         txtDisplayName.Text = objData.DataReader.Item _
             ("DisplayName").ToString
      End If
      objData.DataReader.Close()
  Catch ex As Exception
    'MsgBox(ex.Message)
  End Try
End Using

The program hangs on the line marked >

To verify that I am actually connected I placed a message box immediately before the line that hung. The message box contained this code MsgBox(objData.DataReader.FieldCount) and retur5ned the exact number of fields in the database.

I am at a loss as to how to find and correct this problem.

  #2 (permalink)  
Old March 21st, 2008, 11:03 AM
Authorized User
Points: 406, Level: 7
Points: 406, Level: 7 Points: 406, Level: 7 Points: 406, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2005
Location: Florida
Posts: 88
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Problem Solved

I noticed that I repeated the DataReader twice. When I removed the second entry, the problem disappeared.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Data too long for column 'ResumeInfo' at row 1 Snowby Pro PHP 0 April 2nd, 2008 02:32 AM
insert from one table to 2nd if row already exists brocktune SQL Server 2000 2 May 15th, 2007 12:56 AM
check if a column exists in the table sands SQL Server 2000 2 April 21st, 2006 11:08 PM
How to test if a column exists in a table jtrifts SQL Server 2000 2 February 16th, 2006 02:25 PM
Read a column and Search Row by Row in another col AyatKh Excel VBA 2 January 26th, 2005 12:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.