Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2005
    Location
    The Lone Star State
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Index was outside the bounds of the array.

    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:

    Code:
    DA.Fill(ds, "MASTER_JCM_R1")
    Here is the entire block of code:

    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
    	  				
    </script>

    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.

  • #2
    New Coder
    Join Date
    May 2005
    Location
    The Lone Star State
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •