473,383 Members | 1,963 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,383 software developers and data experts.

SqlDataAdapter.Fill() Performance isues

Hallo all,

I have the following problem. I'm trying to fill a DataTable in a DataSet
with data from an SQL server 2000 database.
I create a SqlConnection, SqlCommand and finally an SqlDataAdapter with
which I fill a table in my DataSet with the
following code:

dt.BeginLoadData();
da.Fill(dt);
dt.EndloadData();

This statement alone takes about 4.7 secs of execution time, which I think
is way too much for a table containing only
6 rows of data containing 4 columns. Does anyone have some advice on how to
speed this up?

(have also tried the .Fill() without the BeginLoadData and EndLoadData
methods, same result)

Extra information: I'm using Visual Studio 2005 and when I run my query in
the Query Analyser it takes about 0.01 secs.

Apr 20 '07 #1
2 8057
Baudin,

What is in the table? What kind of columns are there, and how large are
they?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Baudin" <no****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hallo all,

I have the following problem. I'm trying to fill a DataTable in a DataSet
with data from an SQL server 2000 database.
I create a SqlConnection, SqlCommand and finally an SqlDataAdapter with
which I fill a table in my DataSet with the
following code:

dt.BeginLoadData();
da.Fill(dt);
dt.EndloadData();

This statement alone takes about 4.7 secs of execution time, which I think
is way too much for a table containing only
6 rows of data containing 4 columns. Does anyone have some advice on how
to speed this up?

(have also tried the .Fill() without the BeginLoadData and EndLoadData
methods, same result)

Extra information: I'm using Visual Studio 2005 and when I run my query in
the Query Analyser it takes about 0.01 secs.

Apr 20 '07 #2
Thank you for the reply Nicolas,

The table contains 4 columns, an ID column and 3 columns of type nchar (one
of which is unique). The table has 6 rows of test data. What I have been
able to assert is that the problem is less with the filling of the DataSet
and more with the binding of the controls though the DataSet. I had hoped
that because I fill the DataSet in the constructor of the form instead of in
the Form_Load event the bindings would be placed after the DataSet had been
filled. Apparently I was wrong.

I have changed my code so that the bindings occur "on the fly" and this
seems to have solved the problem. The execution time is now back to an
acceptable 0.01 seconds.

Baudin
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:OH*************@TK2MSFTNGP06.phx.gbl...
Baudin,

What is in the table? What kind of columns are there, and how large
are they?

Apr 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: joseph micheli | last post by:
I have the following code attached to the click event of a button. It fails on the line "da.Fill (ds, "Results") The error is below the code. Any suggestions would be greatly appreciated. ...
1
by: Jerry S | last post by:
I want to know how the method Fill of the SqlDataAdapter is actually programmed. ie. SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); da.Fill(ds); without using a ref...
3
by: W Akthar | last post by:
I am trying to use SqlDataAdapter to execute a Stored Procedure. The Stored Procedure is as follows CREATE Procedure SP_GetAddressesFromContactID @ID int AS SELECT b.StreetAddress1,
2
by: Dan | last post by:
I've created a web form which fills a DataGrid with a DataSet generated from the SqlDataAdapter.Fill method. The adapter's query takes about 30 seconds to complete when I run it in the SQL Server...
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
6
by: M | last post by:
Hi, Does SqlDataAdapter always close the connection (assuming connection was closed before calling Fill()), even if an exception occurs while calling Fill()? Example: try {...
7
by: Matt Jensen | last post by:
Howdy Fairly simple question I think, I presume the answer is no it can't be reused for 2 *SELECT* statements, but just hoping for clarification. Just asking in the interests of trying to minimise...
1
by: Simon1234 | last post by:
Below you will see my code to read data from a database and store it into a dataset. The first, commented code uses an SQLDataReader and the second, uncommented code uses the Fill method of the...
2
by: Adrien Reboisson | last post by:
I'm trying to build a basic DB explorer using C# & Visual Studio 2005. I installed SQL Server 2005 Express, created a blank project, dropped a TreeView, a ListView and a DataGridView : DB objects...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.