RE: DataRowBuilder????

  • Thread starter Thread starter Russ Gray [MS]
  • Start date Start date
R

Russ Gray [MS]

Hi Rick

I think that you're making this too hard. Something like the following
should work:

// Add the tables to the DataSet.
myDataSet.Tables.Add(tCust);


/* Populates the tables. For each customer and order,
creates two DataRow variables. */
DataRow newRow1;

// Create three customers in the Customers Table.
for(int i = 1; i < 4; i++)
{
newRow1 = tCust.NewRow();
newRow1["custID"] = (100*i).ToString();
tCust.Rows.Add(newRow1);
}
// Give each customer a distinct name.
tCust.Rows[0]["custName"] = "John Summers";
tCust.Rows[1]["custName"] = "Phil Seagram";
tCust.Rows[2]["custName"] = "Sam Robinson";


// And address
tCust.Rows[0]["custCity"] = "Chicago";
tCust.Rows[1]["custCity"] = "Los Angeles";
tCust.Rows[2]["custCity"] = "Washington";
}

I hope this helps,

Russ Gray
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
 
Back
Top