|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Intermittent exceptions raised by SqlClientstacktraces by getting the program to email them to me). These two exceptions occur at fairly random intervals: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index 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(CommandBehavior 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) at W3b.AMS.DalSql.Containers.InternalContainerGet(String CompositeName, Int64 ContainerId, Boolean GetUnpublished, Int32 Page, Int32 RecsPerPage) in C:\Documents and Settings\David\My Documents\Visual Studio Projects\W3b\Solutions\W3b.AMS\W3b.AMS.DalSql\DalBases\Containers.cs:line 58 at W3b.AMS.DalSql.Containers.ContainerGet(String CompositeName, Boolean GetUnpublished, Int32 Page, Int32 RecsPerPage) in C:\Documents and Settings\David\My Documents\Visual Studio Projects\W3b\Solutions\W3b.AMS\W3b.AMS.DalSql\DalBases\Containers.cs:line 18 at W3b.AMS.Lib.DAL.Bal.ContainerGet(String CompositeName, Boolean GetUnpublished, Int32 Page, Int32 RecsPerPage) in C:\Documents and Settings\David\My Documents\Visual Studio Projects\W3b\Solutions\W3b.AMS\W3b.AMS.Lib\DAL\Bal.cs:line 517 at W3b.AMS.Pages.Default.LoadContainer(String CompositeName, String Args) in z:\proj\ams\default.aspx.cs:line 175 at W3b.AMS.Pages.Default.LoadPage(String CompositeName, String Args, PageMode PM) in z:\proj\ams\default.aspx.cs:line 132 and Object reference not set to an instance of an object. 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(CommandBehavior 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) at W3b.AMS.DalSql.Base.ExecuteSet(String SprocName, Param[] Params) in C:\Documents and Settings\David\My Documents\Visual Studio Projects\W3b\Solutions\W3b.AMS\W3b.AMS.DalSql\Base.cs:line 91 at W3b.AMS.DalSql.Articles.InternalArticleGet(Int64 i64ArtId, String strCompositeName) in C:\Documents and Settings\David\My Documents\Visual Studio Projects\W3b\Solutions\W3b.AMS\W3b.AMS.DalSql\DalBases\Articles.cs:line 45 at W3b.AMS.DalSql.Articles.ArticleGet(String strCompositeName) in C:\Documents and Settings\David\My Documents\Visual Studio Projects\W3b\Solutions\W3b.AMS\W3b.AMS.DalSql\DalBases\Articles.cs:line 17 at W3b.AMS.Lib.DAL.Bal.InternalArticleGet(Int64 ArticleId, String CompositeName) in C:\Documents and Settings\David\My Documents\Visual Studio Projects\W3b\Solutions\W3b.AMS\W3b.AMS.Lib\DAL\Bal.cs:line 352 at W3b.AMS.Lib.DAL.Bal.ArticleGet(String CompositeName) in C:\Documents and Settings\David\My Documents\Visual Studio Projects\W3b\Solutions\W3b.AMS\W3b.AMS.Lib\DAL\Bal.cs:line 299 at W3b.AMS.Pages.Default.LoadArticle(String CompositeName, Boolean ErrorPage, String ErrorMessage, String Args) in z:\proj\ams\default.aspx.cs:line 225 at W3b.AMS.Pages.Default.LoadArticle(String CompositeName, String Args) in z:\proj\ams\default.aspx.cs:line 220 at W3b.AMS.Pages.Default.LoadPage(String CompositeName, String Args, PageMode PM) in z:\proj\ams\default.aspx.cs:line 128 The source that causes the first exception is here (emphasised line ####): private DataSet InternalContainerGet(string CompositeName, Int64 ContainerId, bool GetUnpublished, Int32 Page, Int32 RecsPerPage) { SqlCommand S = new SqlCommand("ams_ContainerGet", c); S.CommandType = CommandType.StoredProcedure; if(CompositeName.Length < 1) { S.Parameters.Add("@CompositeName", DBNull.Value); } else { S.Parameters.Add("@CompositeName", CompositeName); } if(RecsPerPage != Int32.MinValue) { S.Parameters.Add("@RecsPerPage", RecsPerPage); } else { S.Parameters.Add("@RecsPerPage", DBNull.Value); } if(Page != Int32.MinValue) { S.Parameters.Add("@Page", Page); } else { S.Parameters.Add("@Page", DBNull.Value); } S.Parameters.Add("@ContainerId", ContainerId); S.Parameters.Add("@GetUnpublished", GetUnpublished); SqlDataAdapter A = new SqlDataAdapter(S); DataSet DS = new DataSet(); #### A.Fill(DS); A.Dispose(); S.Dispose(); if(DS.Tables.Count < 1 || DS.Tables[0].Rows.Count != 1) { DS.Dispose(); return null; } return DS; } And the second exception: protected DataSet ExecuteSet(string SprocName, Param[] Params) { SqlCommand S = new SqlCommand(SprocName, c); S.CommandType = CommandType.StoredProcedure; if (Params != null) { int cnt = Params.GetUpperBound(0) + 1; for (int i = 0; i < cnt; i++) { S.Parameters.Add(Params[i].Name, Params[i].Value); } } DataSet DS = new DataSet(); SqlDataAdapter A = new SqlDataAdapter(S); #### A.Fill(DS); A.Dispose(); S.Dispose(); return DS; } (I'll be converting the InternalContainerGet method into a call to ExecuteSet after I sort this problem out BTW). I saw this Microsoft Support article (http://support.microsoft.com/default.aspx?scid=kb;en-us;836874), but whilst it describes the problem, I don't think it matches the same problem. Additionall the article says it was fixed in System.Data 1.1.4322.1007 yet I'm running 1.1.4322.2300 (server) and 1.1.4322.2032 (workstation). Any ideas? |
|||||||||||||||||||||||