Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > BOOK: Beginning VB.NET Databases
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning VB.NET Databases
This is the forum to discuss the Wrox book Beginning VB.NET Databases by Thearon Willis; ISBN: 9780764568008
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET Databases 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 January 31st, 2010, 12:51 AM
Registered User
 
Join Date: Dec 2009
Location: Melb Aus
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Records not appearing in DataGridView - Why?

I have enetred the code to load the data into the DataGridView dsResults as directed in Chapter 7 but the records do not appear even though Debug displays that 9 records were found. What did I do wrong or whats missing from my code? Please help.
I checked the code over and over and it seems to comply with the code in the book though pointing to my Database.

Is there something else I need to do when using a DataGridView as opposed to a DataGrid which is used in the book?

Here is the code for btnSearchClick
Code:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As  _
                                System.EventArgs) Handles btnSearch.Click

        Try



            Dim custCB As SqlClient.SqlCommandBuilder = New  _
            SqlClient.SqlCommandBuilder(adapterResults)
            Dim clsdatabase As New clsDatabase()
            Dim strSQL As String = ""

            ' Load a DataSet with the complete Products, Customers and
            ' Customer Contacts tables (to be used later as code tables to display
            ' choices in a list, etc
            dsData = clsdatabase.LoadCompleteDataSet(CONN)

            ' Load a DataSet with the search results based on the criteria
            ' specified by the user on the form.

            strSQL = BuildSQLStatement()
            dsResults = clsdatabase.LoadSearchDataSet(CONN, strSQL)

            If dsResults.Tables("Results").Rows.Count > 0 Then
                dgdResults.DataSource = dsResults
                'dgdResults.Expand(-1)
                'dgdResults.NavigateTo(o, Results)
                MsgBox("Number of record found = " & dsResults.Tables("Results").Rows.Count)
                MsgBox("Found some records matching your search criteria.")
            Else
                MsgBox("There are no records matching your search criteria.")
            End If



        Catch
            ' Error handling goes here
            UnhandledExceptionHandler()
        End Try
    End Sub
  #2 (permalink)  
Old February 6th, 2010, 09:18 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

What version of Visual Studio are you using?
  #3 (permalink)  
Old February 21st, 2010, 01:12 AM
Registered User
 
Join Date: Dec 2009
Location: Melb Aus
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Records not appearing on DataGridView- Why

I am using Visual Studio 2008. Thanks - was away for a while.


Similar Threads
Thread Thread Starter Forum Replies Last Post
instead of font boxes appearing macdev BOOK: Beginning Mac OS X Programming 1 August 22nd, 2007 05:27 AM
Database not appearing in browser sevans BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 May 30th, 2007 06:46 AM
Add records from a DataGridView to SQL Server 2000 VS2005 Visual Basic 2005 Basics 2 November 27th, 2006 08:32 AM
form re-appearing problem Derek_05 Access VBA 1 January 16th, 2006 07:50 PM
Javascript Errors Not Appearing itHighway Javascript How-To 1 October 13th, 2005 01:30 AM





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