472,325 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,325 software developers and data experts.

Sporadic Error: Cannot find table 0

The application is developed in ASP.Net with a SQL Server database.

Essentially, the application uses a single shared Connection object for
all users logged into the system. The connection object is
opened/closed for each transaction.

The error - System.IndexOutOfRangeException: Cannot find table 0 -
occurs on one page that accepts a single piece of data from a textbox.
This data is then passed to the business logic classes (in VB.Net) and
is queried against the database.

According to the stack trace, the error occurs at:
System.Data.DataTableCollection.get_Item(Int32 index) +79

Out of 100 data entries, this error will appear once or twice. Note
also that when the user enters the same piece of data that caused the
initial run-time error, the second entry executes OK!
Any suggestions?

Thanks:

Pat

Nov 19 '05 #1
3 4140
Pat:
You haven't provided nearly enough information to successfully diagnose the
problem. Somewhere you have a dataset where you are doing something like:

dim dt as DataTable = ds.Tables(0)

or

ds.Tables(0).[SOMETHING]

but ds.Tables(0) isn't a valid table..it's null/nothing and when you try to
access it an index out of range.

While I don't think the shared connection is necessarily a problem in this
case, depending on how it's implemented, this could likely cause you other
types of problems down the road...again, just assuming without seeing any
code.

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"POL8985" <po*****@njit.edu> wrote in message
news:11********************@c13g2000cwb.googlegrou ps.com...
The application is developed in ASP.Net with a SQL Server database.

Essentially, the application uses a single shared Connection object for
all users logged into the system. The connection object is
opened/closed for each transaction.

The error - System.IndexOutOfRangeException: Cannot find table 0 -
occurs on one page that accepts a single piece of data from a textbox.
This data is then passed to the business logic classes (in VB.Net) and
is queried against the database.

According to the stack trace, the error occurs at:
System.Data.DataTableCollection.get_Item(Int32 index) +79

Out of 100 data entries, this error will appear once or twice. Note
also that when the user enters the same piece of data that caused the
initial run-time error, the second entry executes OK!
Any suggestions?

Thanks:

Pat

Nov 19 '05 #2
Thank you, Karl, for your help.

Technically, the IndexOutOfRangeException should never occur because
the data being entered in the ASPX page is actually in the database
(and should return the corresponding set of records in my
DataSet.Table(0))! We've actually never paid explicit attention to
connection pooling and hope this would be key to solving our problem.

Allow me to give you a bit more background into the application.

The ASP.Net application references two DLLs that provide 100% of the
business logic. Each of these DLLs performs all SQL Server
transactions via a data access class we wrote. Each DLL has one global
instance of this data access class (with the same connection string).
The data access class uses a single connection object that is
open/closed with each transaction.

I know that connection pooling is automatically handled by ADO.Net, but
how would I explicitly use it to solve this problem?
Thanks again:

Pat

Nov 19 '05 #3
Pat,
I'm still not sure that the problem isn't simple logic (as in the record
doesn't exist), but as I said, depending on how your data access class is
handled within your two business layers, there could certainly be problems.

First of all, the fact that you have 2 assemblies for your business layer,
each having a separate instance of the data access class isn't likely an
issue, so let's simplify it and say you have 1 assembly (dll) for your
business logic which has a global data access class instace

If your global data access class instance is shared/static and you aren't
implementing some type of locking, you risk having problems (you most
certainly will actually). Remember, ASP.Net is a multithread environment,
and each request will be serviced by an individual thread. however,
shared/static variables are shared by all threads, so two or more threads
(if more than 1 user requests a page) might try to open the same connection,
then one might close it before the other is finished with it. All this
depends a lot on how you are managing the instance within your business
assembly as well as what the data access class itself does. However, if you
haven't considered this, simply creating a new instance of the data access
class as needed might resolve your problem. That is, don't have a
global/shared one, create and dispose as needed. This is how to best allow
ADO.Net's connection pooling to work, open connections as late as possible
and close them as soon as possible. You might be doing this, but if it's in
a shared/static instance, you'll run into threading problems.

Going back to the first issue, have you tried to capture the user inputs for
when the exception is generated? Just incase the error is logical?

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"POL8985" <po*****@njit.edu> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Thank you, Karl, for your help.

Technically, the IndexOutOfRangeException should never occur because
the data being entered in the ASPX page is actually in the database
(and should return the corresponding set of records in my
DataSet.Table(0))! We've actually never paid explicit attention to
connection pooling and hope this would be key to solving our problem.

Allow me to give you a bit more background into the application.

The ASP.Net application references two DLLs that provide 100% of the
business logic. Each of these DLLs performs all SQL Server
transactions via a data access class we wrote. Each DLL has one global
instance of this data access class (with the same connection string).
The data access class uses a single connection object that is
open/closed with each transaction.

I know that connection pooling is automatically handled by ADO.Net, but
how would I explicitly use it to solve this problem?
Thanks again:

Pat

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Svetlana Syrkin | last post by:
Sporadically, our clients receive "page cannot be displayed" error. Failure does not occur at the same line, but error code and description are...
1
by: Travis | last post by:
I have state server running on my webserver. It works fine MOST of the time but frequently I get this error while it is running Error Message:...
3
by: sameer | last post by:
Hi All, i have an asp.net application which has got sql server 2000 behind the scenes. Very simple application, all it does is extract the data...
0
by: Petemo94 | last post by:
Folks, I am getting a "sporadic" exception that contains the following stack trace. I say sporadic b/c my DB connection usually works fine, but...
1
by: POL8985 | last post by:
The application is developed in ASP.Net with a SQL Server database. Essentially, the application uses a single shared Connection object for all...
3
by: Michel Couche | last post by:
Hello, I have an ASP.Net application that uses the Wizard control to build a newsletter. There are three steps in the wizard. The customer's...
1
by: Stefan Braumeister | last post by:
Hi NG, I got some difficult problem that drives me nuts. I wrote a relatively simple extension that reads binary files and extracts some data....
3
by: Daniel Rindt | last post by:
Hello List, i hope to find an answer here, my problem is that my Webserver sporadic offers php scripts for download. I search with google and...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.