TimeOut on SqlDataAdapter.Fill

Discussion in 'ASP .Net' started by Dan, Apr 3, 2004.

  1. Dan

    Dan Guest

    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 Query Analyzer, but when I run
    it from my web page I kept getting a TimeOut exception. So then, as an
    experiment, I changed the way I created the adapter to the following:

    SqlConnection conn = new SqlConnection(m_Conn);
    SqlCommand sqlCommand = new SqlCommand(m_Query, conn);
    sqlCommand.CommandTimeout = 0;
    m_Adapter = new SqlDataAdapter(sqlCommand);

    However, I'm still getting the TimeOut exception on the adapter.Fill method.
    What do I need to do to make this work? The relevant portion of the
    exception reads as follows:


    System.Data.SqlClient.SqlException: Timeout expired. The timeout period
    elapsed prior to completion of the operation or the server is not
    responding. at
    System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
    RunBehavior runBehavior, Boolean returnStream) at
    System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at
    System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(Comman
    dBehavior behavior) at
    System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
    startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
    CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet
    dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
    command, CommandBehavior behavior) at
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
     
    Dan, Apr 3, 2004
    #1
    1. Advertising

  2. Dan

    Dan Guest

    Never mind. I had an extraneous databound column in my datagrid.


    "Dan" <> wrote in message
    news:...
    > 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 Query Analyzer, but when I run
    > it from my web page I kept getting a TimeOut exception. So then, as an
    > experiment, I changed the way I created the adapter to the following:
    >
    > SqlConnection conn = new SqlConnection(m_Conn);
    > SqlCommand sqlCommand = new SqlCommand(m_Query, conn);
    > sqlCommand.CommandTimeout = 0;
    > m_Adapter = new SqlDataAdapter(sqlCommand);
    >
    > However, I'm still getting the TimeOut exception on the adapter.Fill

    method.
    > What do I need to do to make this work? The relevant portion of the
    > exception reads as follows:
    >
    >
    > System.Data.SqlClient.SqlException: Timeout expired. The timeout period
    > elapsed prior to completion of the operation or the server is not
    > responding. at
    > System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior

    cmdBehavior,
    > RunBehavior runBehavior, Boolean returnStream) at
    > System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)

    at
    >

    System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(Comman
    > dBehavior behavior) at
    > System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
    > startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
    > CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet
    > dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
    > command, CommandBehavior behavior) at
    > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
    >
    >
     
    Dan, Apr 3, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. zhaoJian
    Replies:
    0
    Views:
    1,021
    zhaoJian
    Nov 6, 2003
  2. Jerry Higgins
    Replies:
    6
    Views:
    631
    Jerry Higgins
    Apr 21, 2004
  3. M
    Replies:
    7
    Views:
    17,106
    winladen
    Feb 7, 2009
  4. Andy G

    Using sqlDataAdapter to fill Dataset

    Andy G, Jan 31, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    228
    Elton Wang
    Jan 31, 2005
  5. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,298
    Brian Candler
    Oct 6, 2004
Loading...

Share This Page