View Full Version : Index was outside the bounds of the array.

11-22-2005, 06:30 PM
Hello All!

This is the error message my VB.Net page is giving me:

Index was outside the bounds of the array.

This error is caused on the following line of code:

DA.Fill(ds, "MASTER_JCM_R1")

Here is the entire block of code:

<script runat="server">

Dim sConnect as String = "DSN=LacyLTD"

Dim conPerv As ODBCConnection = New ODBCConnection(sConnect)

Sub JPS_Click(sender As Object, e As EventArgs)

Dim strSQL as String = "SELECT * FROM MASTER_JCM_R1 WHERE ltrim(JOB) = '" & TextJobPerf.Text & "'"

Dim cmdMbrs As ODBCCommand = New ODBCCommand(strSQL,conPerv)

Dim DA as ODBCDataAdapter = New ODBCDataAdapter

DA.SelectCommand = cmdMbrs

Dim ds As DataSet = New DataSet

Dim MASTER_JCM_R1 as DataTable = New DataTable

DA.Fill(ds, "MASTER_JCM_R1")

End Sub


I'm sure the connection is good, as it has worked on a different page; but this seems to be an issue of the DataSet not defaulting to a large enough index? Not sure, but would love to hear from anyone with an idea.

Thanks much.

11-22-2005, 09:58 PM
FYI: in case anyone was curious:

I took out the * in the SQL and gave it a specific field to pull. Runs like a champ. I guess there's some kind of limit as to the number of fields it likes.

Dim strSQL as String = "SELECT JOB FROM MASTER_JCM_R1 WHERE JOB = '" & TextJobPerf.Text & "'"