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!

"Index Was Out of Range" in datagrid

Status
Not open for further replies.

anarayan

Programmer
Joined
May 19, 2005
Messages
3
Location
US
In one just case I'm getting this message:
System.ArgumentOutOfRangeException - Index was out of range. Must be non-negative and less than the size of the collection.

Happens in only one instance, works fine for all other tables/queries. I read something about a bug in MSDN but not sure how I can work around it. Happens even when the record count returned is just 1 (not several records that don't fit into one page). The DataBind() throws the exception.

Dim oa As OracleDataAdapter = New OracleDataAdapter (sel, conn)
Dim ds As New DataSet()
oa.Fill (ds, "res")

recCnt = ds.Tables("res").Rows.Count.ToString()

DataGridResults.DataSource = ds
DataGridResults.DataBind()

Any help is greatly appreciated, thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top