471,598 Members | 1,200 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,598 software developers and data experts.

dataset reuse

tg
i have a strongly typed dataset that i will continually refill with
different data using SQL queries and want to process the data in each.

I get the first dataset fine, using a SQL command object and using a
dataAdapter.Fill() etc, and everything works fine. If i want to refill
that dataset with new data using dataAdapter.Fill() again, it doesn't
work. instead, the old data still remains in the dataset.

i've tried using the Clear() and Reset() methds of the dataset before
calling dataAdapter.Fill() with no avail. Here's some pseudocode to
help explain what i'm trying to do.

JobsDS ds = new JobsDS() // my custom dataset
....
//setup the data adapter, sql connection, command object
....

bool done = false;

while(!done)
{
// jobs is the table i'm always pulling data from.
da.fill(ds, "Jobs");
// process dataset with the new data from the above line

if( done_processing)
done = true;
}

Dec 22 '05 #1
2 3192
tg wrote:
i have a strongly typed dataset that i will continually refill with
different data using SQL queries and want to process the data in each.

I get the first dataset fine, using a SQL command object and using a
dataAdapter.Fill() etc, and everything works fine. If i want to refill
that dataset with new data using dataAdapter.Fill() again, it doesn't
work. instead, the old data still remains in the dataset.

i've tried using the Clear() and Reset() methds of the dataset before
calling dataAdapter.Fill() with no avail. Here's some pseudocode to
help explain what i'm trying to do.

JobsDS ds = new JobsDS() // my custom dataset
...
//setup the data adapter, sql connection, command object
...

bool done = false;

while(!done)
{
// jobs is the table i'm always pulling data from.
da.fill(ds, "Jobs");
// process dataset with the new data from the above line

if( done_processing)
done = true;
}


Are you sure that the Dataadapter has the new sql query?

Chris
Dec 22 '05 #2
tg
yes. well, i set the command text to the new value i want it to have.
after the initial setup, i try to do this to "refill" the dataset with
new data:
cmd.CommandText = "SELECT ...."
// i've tried calling dataset.Reset() and dataset.Clear() here
int result = dataAdapter.Fill(dataset, "Jobs")
// result here is zero even when i know the query should return rows

Tyler

Dec 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by GM | last post: by
7 posts views Thread by Jason Huang | last post: by
reply views Thread by martin | last post: by
4 posts views Thread by Craig Buchanan | last post: by
15 posts views Thread by ruca | last post: by
2 posts views Thread by Sandy | last post: by
5 posts views Thread by apandapion | last post: by
7 posts views Thread by =?Utf-8?B?ZG91Zw==?= | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.