473,394 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Additional information: Cannot find table 0. DataGridView

An unhandled exception of type 'System.IndexOutOfRangeException' occurred in System.Data.dll

Additional information: Cannot find table 0.
Expand|Select|Wrap|Line Numbers
  1.    Dim MyDataMiscSource As New DataSet
  2.  
  3.    DBConnMisc = New SqlConnection _
  4.                    ("Data Source=192.168.1.62;Initial Catalog=MyFirstDB;User ID=myuser;Password=mypassword")
  5.  
  6.    ConnectionCMD = New SqlCommand(SQLQueryMisc, DBConnMisc)
  7.  
  8.    DBConnMisc.Open()
  9.         adapterSQLQueryMisc.SelectCommand = ConnectionCMD
  10.  
  11.    MiscDGV.Refresh()
  12.  
  13.    adapterSQLQueryMisc.Fill(MyDataMiscSource)
  14.  
  15.    adapterSQLQueryMisc.Dispose()
  16.  
  17.    ConnectionCMD.Dispose()
  18.  
  19.    DBConnMisc.Close()
  20.  
  21.    MiscDGV.Refresh()
  22.  
  23.    With MiscDGV
  24.       .DataSource = MyDataMiscSource.Tables(0)
  25.       .Columns(0).Width = 170
  26.       .Columns(1).Width = 80
  27.    End With
when I run the application, I am getting an error from the line.
Expand|Select|Wrap|Line Numbers
  1. DataSource = MyDataMiscSource.Tables(0)
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in System.Data.dll

Additional information: Cannot find table 0.
How can I solve this error?
Apr 26 '15 #1
4 2701
zmbd
5,501 Expert Mod 4TB
Please attempt to run your compiler and step thru your code first.
Sounds like your connection isn't valid or you have the table index wrong.
Apr 26 '15 #2
I think the table index issue.
How can i fix the index.

Better yet. I think the table is not filled.

Can you help?
Apr 26 '15 #3
zmbd
5,501 Expert Mod 4TB
I do not do very much dot-net work so we'll have to wait for one of the other experts to wake-up and take a look at the site.
Meantime it would be a good idea to step thru you code and make sure that the connection opened and that the data actually transferred when you called adapterSQLQueryMisc.Fill(MyDataMiscSource)
Apr 26 '15 #4
It looks like I am getting a different error below:

An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
Apr 26 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: MLH | last post by:
The Microsoft Jt database engine can not find tblJobSites, error #3078. That's what I get when executing this code... Private Sub Command1_Click() Dim MyWorkspace As Workspace Set MyWorkspace...
2
by: michael Schindler | last post by:
I get an error message since i installed visual studio 2003 :-( Please help me why i get this message? An unhandled exception of type 'System.ObjectDisposedException' occurred in...
0
by: Matthew Louden | last post by:
I am trying to implement the sort event in data grid. I set the data grid's AllowSorting property = True. I implement the following code that should be the event will fire when the user click any...
3
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 users logged into the system. The connection...
1
by: OrionLee | last post by:
I am using C# to work with a 3rd party DLL (Nevron Charts), and attempting to serialise it. The serialisation itself is handled somewhere inside the DLL, so to get it to happen you call the Nevron's...
1
by: jadeite100 | last post by:
Hi All: I installed oracle report server 10.1.2.02 I tried the following url and it display the page properly that ask Test run Job: http://xxx/reports/rwwebservice?operation=runJob When I...
2
by: dowlingm815 | last post by:
I am attempting to create a table with an index. however, i am receiving an error code "3371: Cannot find table or constraint" as soon as it reads the "create index" statement. The code is as...
1
ramanan ram
by: ramanan ram | last post by:
hi.. here,i am getting System.IndexOutOfRangeException: Cannot find table 0.this error. coding: OleDbConnection conn1 = new OleDbConnection(conn); conn1.Open(); ...
3
by: whatdoido | last post by:
I'm suppose to make a table called MOVSTARDIR, and am suppose to have mvnum, starnum, and dirnum as primary keys with referential integrity enforced but I keep getting Cannt find table or constraint...
0
by: immabulletproof | last post by:
as i run my application this the output after the login. These are my codes from my vb. Public Function IsUserAuthorized() As Boolean If oledbLogin.DS IsNot Nothing Then ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.