An unhandled exception of type 'System.IndexOu tOfRangeExcepti on' occurred in System.Data.dll
Additional information: Cannot find table 0.
when I run the application, I am getting an error from the line.
How can I solve this error?
Additional information: Cannot find table 0.
Code:
Dim MyDataMiscSource As New DataSet
DBConnMisc = New SqlConnection _
("Data Source=192.168.1.62;Initial Catalog=MyFirstDB;User ID=myuser;Password=mypassword")
ConnectionCMD = New SqlCommand(SQLQueryMisc, DBConnMisc)
DBConnMisc.Open()
adapterSQLQueryMisc.SelectCommand = ConnectionCMD
MiscDGV.Refresh()
adapterSQLQueryMisc.Fill(MyDataMiscSource)
adapterSQLQueryMisc.Dispose()
ConnectionCMD.Dispose()
DBConnMisc.Close()
MiscDGV.Refresh()
With MiscDGV
.DataSource = MyDataMiscSource.Tables(0)
.Columns(0).Width = 170
.Columns(1).Width = 80
End With
Code:
DataSource = MyDataMiscSource.Tables(0)
An unhandled exception of type 'System.IndexOu tOfRangeExcepti on' occurred in System.Data.dll
Additional information: Cannot find table 0.
Additional information: Cannot find table 0.
How can I solve this error?
Comment