Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
adya
Starting Member
31 Posts |
Posted - 2009-01-26 : 20:19:00
|
| HiI am getting this sporadic error: System.IndexOutOfRangeException: Cannot find table 0.It occurs every now and then and I have tried debugging the application, but it never seems to happen when i want to recreate it. The code is as follows:public DataTable Jobs { get { SqlCommand command = new SqlCommand("SchShowAllSchedule", ConnectionUtil.OpenConnection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@ResId", ResId); command.Parameters.AddWithValue("@DateStart", startDate);command.Parameters.AddWithValue("@DateEnd", endDate);SqlDataAdapter adapter = new SqlDataAdapter(command);DataSet ds = new DataSet();adapter.Fill(ds); if (ds.Tables.Count != 0 && ds.Tables[0] != null) { DataTable table = ds.Tables[0]; return table; } else return null; } }The stack trace is:Error: System.IndexOutOfRangeException: Cannot find table 0. at System.Data.DataTableCollection.get_Item(Int32 index) at ScheduleCom.Resource.get_Jobs() at ScheduleCom.Resource.get_Indices() at ScheduleCom.GraphCreator.CreateUserRow(DataRow row, String Name, String checkBoxId, String hiddenId, String rowId, Int32 TotalCols, Int32 ResId, DateTime DateStart, DateTime DateEnd) at ScheduleCom.GraphCreator.CreateGrid(DateTime startingDate, String branchId) at ScheduleCom.GraphCreator.GenerateGraph(DateTime startingDate, String branchId) at WorkFlow.Scheduler._default.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)Adya |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|
|