Re: DataTable.New() and Rows.Add() not working right

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Cor Ligthert (notfirstname_at_planet.nl)
Date: 06/01/04


Date: Tue, 1 Jun 2004 20:06:22 +0200

Hi Joe,

Why that ItemArray and not the Item, when I understand what you want is it
to find the proper column by the proper item you read with the datareader.

while (sqlReader.Read() )
{
  DataRow dr = dtProducts.NewRow();
 dr.Item["Col1"] = sqlReader.GetString(0);
\\ set more Items
dtProducts.Rows.Add(dr);
 }
ds.WriteXml(@"X:\temp\Test.xml");

I hope this helps?

Cor