SqlException on TableAdapter.GetData()... RRS feed

  • Question

  • Greetings,

    I am trying to get to the bottom of this issue I am having...

    Exception Details: System.Data.SqlClient.SqlException:

    Stack Trace:

    [SqlException (0x80131904): ]
     System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
     System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
     System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
     System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
     System.Data.SqlClient.SqlDataReader.CloseInternal(Boolean closeReader) +169
     System.Data.SqlClient.SqlDataReader.Close() +96
     System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +292
     System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
     System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
     System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
     System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
     System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
     System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
     System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
     System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
     System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +115
     PERA_Web.DataSet1TableAdapters.GroupMonthlyReportTableAdapter.GetData(Nullable`1 group_id) in C:\Documents and Settings\tmarsden\My Documents\Visual Studio 2008\Projects\PERA SVN\Devsource\PERA\PERA_Web\DataSet1.Designer.cs:6782
     PERA_Web.PERAManager.GroupForm.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\tmarsden\My Documents\Visual Studio 2008\Projects\PERA SVN\Devsource\PERA\PERA_Web\PERAManager\GroupForm.aspx.cs:44
     System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
     System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
     System.Web.UI.Control.OnLoad(EventArgs e) +99
     System.Web.UI.Control.LoadRecursive() +50
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

    Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

    It seems similar to the issue described here ( ) and here ( , but I am not using a finalize method anywhere. I have a DataSet with a TableAdapter, that's it. Any insight or feedback would be greatly appreciated.


    Tom Marsden


    Here is my TableAdapter's GetData() method...the excpetion occurs on this.Adapter.Fill(dataTable);

     [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
     public virtual DataSet1.GroupMonthlyReportDataTable GetData(global::System.Nullable<int> group_id) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((group_id.HasValue == true)) {
     this.Adapter.SelectCommand.Parameters[1].Value = ((int)(group_id.Value));
     else {
     this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
     DataSet1.GroupMonthlyReportDataTable dataTable = new DataSet1.GroupMonthlyReportDataTable();
     return dataTable;
    Monday, September 27, 2010 4:38 PM

All replies

  • Hi Tom,

    Is there no other detail to the error message aside from SqlException (0x80131904)? Normally there will be some error description, like:

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible...


    An error has occurred while establishing a connection to the server. ...


    Timeout expired...

    There are many other possibilities. Perhaps there is more in the event logs?


    Cathy Miller

    Microsoft Online Community Support

    Friday, October 1, 2010 8:57 PM
  • Hi Cathy,

    Thank you for your reply. This is the excpetion information that is being passed back to the web application, and is the only exception detail I can see while debugging as well. I will look into the event logs to see if I can find more.

    Kind Regards,


    P.S. I have an alert for this thread, should I have recieved an email when there is a new post? I did not recieve one for your response...


    Friday, October 8, 2010 5:04 PM
  • Hi Tom,

    Does this error happen consistently or does it work sometimes and fail other times?

    Did you find any more details in the event log?

    Can you run a SQL Profiler trace during the time of the error to capture Attentions and Exceptions to see if that reveals any further information?


    Cathy Miller

    Microsoft Online Community Support


    Thursday, October 14, 2010 3:04 PM
  • Hey Cathy,

    I got to the bottom of my issue. I used SQL Profiler and found that the stored procedure was timing out after 30 seconds. I am guessing this is default or something. Changing the CommandTimeout in the Adapter's GetData() method did the trick...

    this.Adapter.SelectCommand.CommandTimeout = 600;

    Is there any way to set the timeout other than going into the Designer.cs file?



    Wednesday, November 3, 2010 4:52 PM
  • Hi Tom,

    You could configure your application to read the value from a config file.


    Cathy Miller

    Microsoft Online Community Support

    Thursday, November 4, 2010 4:29 PM