Please Help

G

Guest

Hello All,

I'm getting this error on a ASP .NET apps:

Index 2 is not non-negative and below total rows count.

Line 443:
Line 444: Dim ParentTableView As New
DataView(DsSellers1.Tables("SELLERS"))
Line 445: Dim CurrentRowView As DataRowView =
ParentTableView(Me.cboSellers.SelectedValue)
Line 446:
Line 447: grdSellers.DataSource =
CurrentRowView.CreateChildView("SellersRelation")

Stop at Line 445. Here is my source code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
If Not Page.IsPostBack Then
'Fill all DataAdapters into DsSellers dataset.
Me.daSellers.Fill(Me.DsSellers1)
Me.daDoc_Type.Fill(Me.DsSellers1)
Me.daOccupancy.Fill(Me.DsSellers1)
Me.daProduct_Code.Fill(Me.DsSellers1)
Me.daProperty_Type.Fill(Me.DsSellers1)
Me.daPurpose.Fill(Me.DsSellers1)

'Data bind all data to their controls.
Me.cboSellers.DataBind()
End If

Catch ex As Exception
Response.Write(ex.Message)
Finally
Me.ConnWBOC5177.Close()
Me.ConnWBOC5177.Dispose()
End Try

End Sub

Private Sub cboSellers_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboSellers.SelectedIndexChanged
Dim ParentColumn As DataColumn
Dim ChildColumn As DataColumn

ParentColumn = DsSellers1.Tables("SELLERS").Columns("SELLER_ID")
ChildColumn =
DsSellers1.Tables("DOC_TYPE_LISTING").Columns("SELLER_ID")

Dim drSellers As New DataRelation("SellersRelation", ParentColumn,
ChildColumn)
DsSellers1.Relations.Add(drSellers)

Dim ParentTableView As New DataView(DsSellers1.Tables("SELLERS"))
Dim CurrentRowView As DataRowView =
ParentTableView(Me.cboSellers.SelectedValue)

grdSellers.DataSource =
CurrentRowView.CreateChildView("SellersRelation")
grdSellers.DataBind()
End Sub

Can someone help me? I just want to able find related data from the
DropDownList control to the Datagrid use DataRelation object. The Datagrid
will be using it's own queries for Select, Insert, Delete, Update.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top