Click to See Complete Forum and Search --> : DetailsView


KMekgwe
04-13-2007, 08:51 AM
I've got the following function in my business layer for updating on a details view:

Dim strSQL As String
Dim obj As Datalayer.Database = New Datalayer.Database
strSQL = "Update Client set ClientType = '" & Type & "',EmailAddress = '" & Email & "',TelephoneNumber = '" & Telephone & "',FaxNumber = '" & Fax & "',Location = '" & location & "',City = '" & city & "',ClientRegNumber = '" & RegNo & "',PostalCode = '" & postal & "' where ClientID ='" & CID
UpdateclientDetails = obj.GetDataSet(strSQL)
obj.Close()

and in my Presentation tier my item_updatind event is as follows:

Dim gv1 As DetailsView = CType(sender, DetailsView)
Dim obj As Businesslayer.Clients = New Businesslayer.Clients
Dim ds As Data.DataSet


ds = obj.UpdateclientDetails(Trim(CStr(e.NewValues(0))), Trim(CStr(e.NewValues(1))), Trim(CStr(e.NewValues(2))), Trim(CStr(e.NewValues(3))), Trim(CStr(e.NewValues(4))), Trim(CStr(e.NewValues(5))), Trim(CStr(e.NewValues(6))), Trim(CStr(e.NewValues(7))), Trim(CStr(e.NewValues(8)))) 'gv1.SelectedValue.ToString())
obj = Nothing
DetailsView1.DataSource = ds
DetailsView1.DataBind()

When I run my application & click the update command it displays as follows:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

what might be the problem

Ribeyed
04-19-2007, 03:46 PM
Hi
i count 8 fields in your sql statement but in your code you have index 0-8 which is 9.