SqlDataAdapter.Fill() Performance isues

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Baudin

    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.BeginLoadDat a();
    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.



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: SqlDataAdapter. Fill() Performance isues

    Baudin,

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


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Baudin" <nospam@nospam. comwrote in message
    news:%235dQjY0g HHA.4552@TK2MSF TNGP04.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.BeginLoadDat a();
    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.
    >
    >
    >

    Comment

    • Baudin

      #3
      Re: SqlDataAdapter. Fill() Performance isues

      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]" <mvp@spam.guard .caspershouse.c omwrote in
      message news:OHIcuy1gHH A.596@TK2MSFTNG P06.phx.gbl...
      Baudin,
      >
      What is in the table? What kind of columns are there, and how large
      are they?

      Comment

      Working...