Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ 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 March 27th, 2006, 05:37 AM
Registered User
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error occur when Add a DataRow[] into a DataTable

 Dear Programer,

I kept received the error message "Object reference not set to an instance of an object", pls help!!! :(

I added "//error occur" in the line. Thanks a lot!

            DataTable* selectedTable = new DataTable();
            selectedTable = this->localDB->Tables->Item[S"BusinessCard"]->Clone();
            selectedTable = localDB->Tables->Item[S"SelectedTable"];
            DataRow* selectedRow[];

            selectedRow = this->localDB->Tables->Item[S"BusinessCard"]->Select("Industry='Education'", "Index Desc");
            for (int i=0; i<selectedRow->Length; i++)
                selectedRow[i] = localDB->Tables->Item[S"selectedTable"]->NewRow(); //error occur
                localDB->Tables->Item[S"selectedTable"]->Rows->Add(selectedRow[i]); //error occur
            this->dataGrid1->DataSource = this->localDB;
            this->dataGrid1->DataMember = S"SelectedTable";

Similar Threads
Thread Thread Starter Forum Replies Last Post
error occur when i use crystal report ssomchai BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 August 25th, 2008 09:02 PM
How to add a DataRow to a DataSet? jhansib4u ADO.NET 1 January 8th, 2008 09:36 AM
Backcolor for separate rows DataRow in Datatable i mikeka VS.NET 2002/2003 0 July 3rd, 2006 08:03 PM
how to add a dataRow[] into a datatable sendtogary VS.NET 2002/2003 0 March 27th, 2006 05:32 AM
Occur error when run aspx file bapechun ASP.NET 1.0 and 1.1 Basics 11 May 19th, 2004 07:24 AM

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