473,734 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataRowCollecti on.Add in .NET 2

1 New Member
Hi,
my name is Iram.
I'm upgrading my winform application which was developed
in .NET 1.1 to .NET 2.
There is a code section that works well in .NET 1.1, but in .NET 2 raises an Exception of:{"Object reference not set to an instance of an object."} System.Exceptio n {System.NullRef erenceException }
The code is:
DataRowCollecti on rc;
DataRow newSearchRow;
rc = searchQuestions .Rows;
newSearchRow = searchQuestions .NewRow();
newSearchRow[1] = 0;
newSearchRow[4] = "Search Questions";
rc.Add(newSearc hRow); <--This row execute the Exception

Explanation: The 'searchQuestion s' is an instance of an object that I wrote that inheritance from DataTable and has several columns.

Does any one have any suggestion?
Iram
Jan 1 '07 #1
0 1157

Sign in to post your reply or Sign up for a free account.

Similar topics

1
415
by: Derrick | last post by:
Hi all, I've been trying to understand exactly how to insert a newly created DataRow into a DataRowCollection at a specified row value without much luck. At first I was just appending the collection with the Add method. That worked fine, but not the InsertAt method. It always inserts the new row at the end, just like Add did. Thanks for wathever help you can give. Cheers, Derrick
2
5680
by: Scott Adams | last post by:
When calling the Find function of a DataRowCollection, one has two options: Overloads Public Function Find(ByVal key As Object) As DataRow or Overloads Public Function Find(ByVal keys() As Object) As DataRow This function is easy to use if the primary key of your DataTable consists of only one field. How can you use the Find functions if the primary key consists of two database fields (composite key)?
4
5594
by: Marc Pelletier | last post by:
Hello, I am trying to use the find method to locate a particular record in a table. The code is : objectfindTheseVals = new object; findTheseVals = station_ID; // an integer findTheseVals = dt; // a datetime DataRow foundRow = dsStationDays.Tables.Rows.Find( findTheseVals);
0
2826
by: Steve Richter | last post by:
how do I sort the Rows DataRowCollection of a DataTable? I have sub classed the DataRow class and added the IComparable interface: public class ResultsTableRow : System.Data.DataRow, IComparable { public ResultsTableRow( DataRowBuilder builder ) : base( builder ) {
0
963
by: Matt Tapia | last post by:
I have a datarow collection (drAccountInfo), and I want to add each row to a datatable that is then added to a dataset...here is my code: Dim iCount As Integer Dim myDataTable As New DataTable For iCount = 0 to drAccountInfo.Length-1 Trace.Warn(iCount) myDataTable.ImportRow(drAccountInfo(iCount)) Next iCount
2
4263
by: Bill Nguyen | last post by:
What do I need to do to add a row to a table with single column? I got the "mnarrowing conversion" ewrror mesage. Thanks Bill -----------------
2
3385
by: George | last post by:
Hi, I have encountered the following problem. Say I have the following, DataGridView dgv; DataTable dt; OleDbDataAdapter oleDb_da; (bound to a OleDb data connection)
3
7723
by: Carlos | last post by:
Hi all, I have 2 asp .net 2.0 projects currently being developed. One is in VB .Net and the other in C#. In the VB .Net project I can cross-reference a datatable object using the datatable.rows.item(i).item(j) , but in the C# project I can not do it. That is, I do get: error 'System.Data.DataRowCollection' does not contain a definition for 'Item' They are running under the same development evironment. (i.e. Asp .Net 2.0)
3
5767
by: EmilH | last post by:
Hi. I have read some examples of IEnumerator at http://www.codeproject.com/csharp/csenumerators.asp What if I have 2 arrays or collections, for example a DataSet which has 2 DataTables in my class which derives from IEnumerator? How to implement Current property to return current item of the desired DataTable? Thanks. Emil.
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.