Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Message - Index was out of range.

Status
Not open for further replies.

zatch

MIS
Joined
Oct 11, 2001
Messages
75
Location
US
I am getting an error that reads: "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index."

I have my main form, which I'll call form1. On form1 I have a button that launches form2. form2 is setup to search our database and return all matches in a datagrid. I then have a sub that runs when you click datagrid which selects the unique number for the record found in the search, and then closes form2 while returning the unique identifier found through the search/datagrid click (intCurrentRecord) to form1. I haven't ever gotten this error on my development machine. I have the executible on a file server and everyone has a shortcut directly to it on their desktop. The error is pretty rare in the morning, but by 4:00 PM you get it on almost every attempt to search our database. I'm hoping you guys can help. The code in question is shown below.

Thanks.

Zatch




Here is code to recreate my error:

Private Sub Load_dsErEeEp1()

If SqlConnection1.State = ConnectionState.Closed Then
SqlConnection1.Open()
End If

EmployerDataAdapter.SelectCommand.Parameters(0).Value = intCurrentRecord
EmployeeDataAdapter.SelectCommand.Parameters(0).Value = intCurrentRecord
PlanDataAdapter.SelectCommand.Parameters(0).Value = intCurrentRecord
CorrespondenceRequestDataAdapter.SelectCommand.Parameters(0).Value = intCurrentRecord
CallDataAdapter.SelectCommand.Parameters(0).Value = intCurrentRecord

DsErEeEp1.Clear()
EmployerDataAdapter.Fill(DsErEeEp1)
EmployeeDataAdapter.Fill(DsErEeEp1)
PlanDataAdapter.Fill(DsErEeEp1)
CorrespondenceRequestDataAdapter.Fill(DsErEeEp1)
CallDataAdapter.Fill(DsErEeEp1)

end sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top