G
Guest
Hi all,
I want to keep adding a row of data each time to the datatable of a dataset.
I see on msdn that I could do this:
ie.
workRow = workTable.NewRow();
workTable.Rows.Add(new Object[] {1, "Smith"});
eg. I have:
DataRow row = ds.Tables["AA"].NewRow();
ds.Tables["AA"].Rows.Add(new Object[] {xxxxxxxxxxx});
I was wondering if I could add a row each time by running a sql statement.
How do I do this instead of using an Object[] array ?? My existing code is as
below:
int intPID=1;
for (int i = 1; i<= 20; i++)
{
strCommandA = "select * from Product where productID="+ intPID;
SqlDataAdapter myCommandA = new SqlDataAdapter(strCommandA, myConnection);
myConnection.Open();
xxxx
myConnection.Close();
intPID++;
}
TIA.
regards,
andrew
I want to keep adding a row of data each time to the datatable of a dataset.
I see on msdn that I could do this:
ie.
workRow = workTable.NewRow();
workTable.Rows.Add(new Object[] {1, "Smith"});
eg. I have:
DataRow row = ds.Tables["AA"].NewRow();
ds.Tables["AA"].Rows.Add(new Object[] {xxxxxxxxxxx});
I was wondering if I could add a row each time by running a sql statement.
How do I do this instead of using an Object[] array ?? My existing code is as
below:
int intPID=1;
for (int i = 1; i<= 20; i++)
{
strCommandA = "select * from Product where productID="+ intPID;
SqlDataAdapter myCommandA = new SqlDataAdapter(strCommandA, myConnection);
myConnection.Open();
xxxx
myConnection.Close();
intPID++;
}
TIA.
regards,
andrew