Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 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
 
Old August 17th, 2004, 09:01 AM
Authorized User
 
Join Date: Jul 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataGrid Troubles

Can anyone tell me what is wrong with my code below:
----------------------
 Sub BuildDataGrid()
        Dim objUser As New clsUser()
        Dim objDBConn As OleDbConnection
        Dim objDBComm As OleDbCommand
        Dim objDataReader As OleDbDataReader()
        Dim strSQL As String

        Dim objGetConnection As New clsDBConnection()
        objDBConn = objGetConnection.GetDatabaseConnection

        strSQL = "SELECT * FROM [User]"

        objDBConn.Open()
        objDBComm = New OleDbCommand(strSQL, objDBConn)
        objDataReader = objDBComm.ExecuteReader(System.Data.CommandBehavio r.CloseConnection)
        CityDataGrid.DataSource = objDataReader
        CityDataGrid.DataBind()
        objDBConn.Close()

    End Sub
------------------------------
Keep getting the following error:
Value of type 'System.Data.OleDb.OleDbDataReader' cannot be converted to '1-dimensional array of System.Data.OleDb.OleDbDataReader'.

Thanks,
Mark


 
Old August 17th, 2004, 11:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

For a data grid, I see as valid data sources (in the MSDN) as: DataSet, DataTable, DataView, DataViewManager, anything that inherits IList and IListSource. I don't see the DataReader; and it doesn't inherit those interfaces. Try using a data table instead.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Shader troubles Largo39 BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 0 August 9th, 2007 03:01 PM
Troubles with Programm AlisaSmi Excel VBA 0 March 7th, 2007 07:50 AM
CurrentRegion troubles Glen Frank Excel VBA 2 July 20th, 2005 07:04 AM
PHP Troubles[:D] peter_budo BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 September 3rd, 2004 04:42 PM
Interop Troubles Yehuda Pro VB.NET 2002/2003 0 June 29th, 2004 01:26 PM





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