?
Solved

ASP.NET - Cannot find table 0.

Posted on 2011-03-11
6
Medium Priority
?
2,034 Views
Last Modified: 2013-12-17
After I rebuild my database procedures on the production server, I'm getting the following error.

-------------------------------------------------------------------------------------------------------------
Cannot find table 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Cannot find table 0
--------------------------------------------------------------------------------------------------------------

I've attached the stack trace below.  I sure could use some advice in debugging / fixing this issue.
[IndexOutOfRangeException: Cannot find table 0.]
   System.Data.DataTableCollection.get_Item(Int32 index) +95
   ParkAsset.ParkAsset.DataAccess.GetFeatureValue(String ControlIdentity, String FeatureName) in C:\Users\jdana\Documents\DSD\Parks03\101218 - Production Web Interface\ParkAsset\App_Data\DataAccess.vb:288
   ParkAsset.ParkAsset.PagePrepper.DropDownListPrep(DropDownList ddl) in C:\Users\jdana\Documents\DSD\Parks03\101218 - Production Web Interface\ParkAsset\App_Data\PagePrepper.vb:104
   ParkAsset.ParkAsset.PagePrepper.PrepControls(Control ControlContainer, Int64 PrepType, Boolean Napalm, Int64 WorkOrderID) in C:\Users\jdana\Documents\DSD\Parks03\101218 - Production Web Interface\ParkAsset\App_Data\PagePrepper.vb:68
   ParkAsset.ParkAsset.PagePrepper.PrepControls(Control ControlContainer, Int64 PrepType, Boolean Napalm, Int64 WorkOrderID) in C:\Users\jdana\Documents\DSD\Parks03\101218 - Production Web Interface\ParkAsset\App_Data\PagePrepper.vb:87
   ParkAsset.WorkOrder.Page_Load(Object sender, EventArgs e) in C:\Users\jdana\Documents\DSD\Parks03\101218 - Production Web Interface\ParkAsset\workorder.aspx.vb:27
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

Open in new window

0
Comment
Question by:jdana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 2000 total points
ID: 35107035
This error will come when you try to fetch data when there is not data returned from database.

might be your procedure not returning any data

can you share our .net code where error comes?
0
 

Author Comment

by:jdana
ID: 35107091
pratima_mcs,

Happy to.  I believe this is the problem code.  (DataAccess.vb:288) .  Here's the tricky part, my code loops on all the controls in the web page and uses the procedure WebRowSrcDrvFeatureValue to retrieve values associated with each control.  In other words, this procedure is called again and again during page load.  I'm not sure how to determine which control (ControlIdentity) and which feature (FeatureName) are giving the code trouble.

      Public Function GetFeatureValue(ByVal ControlIdentity As String, ByVal FeatureName As String) As String
         ' =============================================================================
         ' Purpose.: Return a Feature value based on an ASP control name and Feature name.
         ' Params..: ControlIdentity = The name (ID) of the control.  The value must match the 
         '           ControlIdentity found in WebRowSrcDrvFeatureValue.
         '           FeatureName = The name of the control Feature.  The value must match  
         '           the FeatureName found in WebRowSrcDrvFeatureValue.
         ' Returns.: The Feature value (as a string)
         ' =============================================================================

         Dim ds As DataSet
         Dim Parameters(1) As String

         Parameters(0) = ControlIdentity
         Parameters(1) = FeatureName
         ds = GetDataSetBasedOnSprocAndParams("WebRowSrcDrvFeatureValue", Parameters)
         If Not ds Is Nothing And ds.Tables(0).Rows.Count = 1 Then
            Return ds.Tables(0).Rows(0)(0).ToString()
         Else
            Return ""
         End If

      End Function

Open in new window

0
 
LVL 9

Expert Comment

by:gery128
ID: 35107121
This may also happen if you are using wrong connection string, I mean, invalid or connection string pointing to some different database.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 35107267
debug after this statemen and check whether you are getting anything in ds table 0
may be you will get result in table 1

 ds = GetDataSetBasedOnSprocAndParams("WebRowSrcDrvFeatureValue", Parameters)


did you have two select statement in store procedure?
0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 2000 total points
ID: 35107599
check condition like this

  If (ds.Tables(0) Is Nothing) Then

        End If
0
 

Author Closing Comment

by:jdana
ID: 35113695
The sproc was coming up empty.  That was it.  Thanks!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question