K
Kevin
Hi All
I have a couple of questions, I am not at a machine with
VS.NETso that is why I am asking them here
1. When working with a dataset, how do I go to a specific
record and update a field in a table in the dataset? I
know you could probably run the updateCommand for the
DataAdapter, but that would update the data directly in
the database, and not in the dataset - not so? I want to
update a field in my datasets' datatable and then somehow
tell the dataset to update the database, how do I do this?
2. This one is about dataRelations. I have set up a
datarelation between two datatables in my dataset. Now I
have a for each loop that cycles through each record in
the one datatable, inside that for loop I want another for
each loop that will get me the child rows for the parents
ID column. my code looks something like this
for each (DataRow dr in dataset.tables["tablename"])
{
for each (DataRow childdr in dr.GetChildRows(Datarelation)
{
//do some work here
}
}
The inside for each, executes, but it is as if there are
no child rows for this parent column, .... but there is,
when I check the database. Is there something else that I
might be missing. I have setup the Datarelations
correctly, I have checked them sooo many times.
Any suggestions?
Thanks for any help it's greatly appreciated, If I have
not explained myself very well please let me know, I am
new to C#.
Thanks
Kevin
I have a couple of questions, I am not at a machine with
VS.NETso that is why I am asking them here
1. When working with a dataset, how do I go to a specific
record and update a field in a table in the dataset? I
know you could probably run the updateCommand for the
DataAdapter, but that would update the data directly in
the database, and not in the dataset - not so? I want to
update a field in my datasets' datatable and then somehow
tell the dataset to update the database, how do I do this?
2. This one is about dataRelations. I have set up a
datarelation between two datatables in my dataset. Now I
have a for each loop that cycles through each record in
the one datatable, inside that for loop I want another for
each loop that will get me the child rows for the parents
ID column. my code looks something like this
for each (DataRow dr in dataset.tables["tablename"])
{
for each (DataRow childdr in dr.GetChildRows(Datarelation)
{
//do some work here
}
}
The inside for each, executes, but it is as if there are
no child rows for this parent column, .... but there is,
when I check the database. Is there something else that I
might be missing. I have setup the Datarelations
correctly, I have checked them sooo many times.
Any suggestions?
Thanks for any help it's greatly appreciated, If I have
not explained myself very well please let me know, I am
new to C#.
Thanks
Kevin