473,394 Members | 1,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 3267
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: GM | last post by:
-What is the advantage of placing the dataset into the designer? -is it possible to share adapters across webforms? -is it possible to created a set of adapter with one dataset to reuse across...
7
by: Jason Huang | last post by:
Hi, The SQL string is "select * from Customer where 0 > 1", and the DataSet should be null. Why MyDataSet.Tables.Count is 1, not 0? What kind of DataTable in this place? Thanks for help. ...
0
by: martin | last post by:
Hi, I am storing a dataset in cache, which is happening fine. I can easily retrive it at postback from the cache, cast it to a dataset and reuse it. However I have specified that the cache...
4
by: Craig Buchanan | last post by:
I would like to reuse a SQLDataReader that is populated with information as the datasource for multiple dropdownlists. Unfortunately, the first DDL closes the SDR and my code fails on the second...
15
by: ruca | last post by:
Hi, Can I read a .TXT File to a DataSet? How can I do that? I want to read his lines to a DropDownList. This lines are the names of employees that I export from an application that I have. I...
10
by: Victor | last post by:
Hello there, I have a module in VB.NET (ASP.NET) and on top I declare the SqlConnection and the SqlDataAdapter. Like: Module AccessDB Dim sqlCmd As New SqlCommand Dim conAanvraag As New
2
by: Sandy | last post by:
Hello - I have the following stored procedure and code. I want to put the results in two textboxes. I get to the part where I create the dataset and then I don't know what to do. I tried...
5
by: apandapion | last post by:
I'm working with csharp and .net for the first time, and I've had a fair amount of luck. I started with the MSDN "Walkthrough : Creating a Distributed Application" tutorial and expanded from...
7
by: =?Utf-8?B?ZG91Zw==?= | last post by:
Have loaded balanced web servers that we do not allow to connect to our database. Content is created and pushed to these sites. I want to add a web service that may get multiple requests a second...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.