C# .NET - In DataRow ItemArray value doesnot change

Asked By Sivanesh Vanmeeganathan on 30-Oct-12 06:24 AM
I tried like these methods but it doesnot work

dtrow.ItemArray[i] = "";

dtrow.ItemArray.SetValue("", i);


Kindly give me solutions......(ASAP)
Tom Wilson replied to Sivanesh Vanmeeganathan on 31-Oct-12 10:11 AM
The ItemArray property of a Datarow cannot be indexed.  To set this property you need to use an array.  An example of a way to use the ItemArray property:

dtrow.ItemArray =  {"Matt", "Joanne", "Robert"};

or

string[] Names;
Names = new string[3];
Names[0] = "Matt";
Names[1] = "Joanne";
Names[2] = "Robert";
dtrows.ItemArray = Names;

The above examples assumes dtrow has 3 columns defined as strings.