473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DataRowCollection.Add in .NET 2

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.Exception {System.NullReferenceException}
The code is:
DataRowCollection rc;
DataRow newSearchRow;
rc = searchQuestions.Rows;
newSearchRow = searchQuestions.NewRow();
newSearchRow[1] = 0;
newSearchRow[4] = "Search Questions";
rc.Add(newSearchRow); <--This row execute the Exception

Explanation: The 'searchQuestions' 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 1137

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

Similar topics

1
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...
2
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...
4
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 =...
0
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,...
0
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 ...
2
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
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
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.