Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I am getting error when i write the code in gridview_updating.
Error from : SQLADR.Update(cmbFrm.SelectedValue, cmbTo.SelectedValue) --> value of type 'string' cannot be converted to 'system.data.dataset.

What is the Error.?
See below code.

Protected Sub grdDeptEmp_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdDeptEmp.RowUpdating
      'To Fetch the data based on the Emp Number and update
      StrQry = "Select FromPeriod,ToPeriod from OtherDeptEmp"
      SQLADR = New SqlDataAdapter(StrQry, Conn)
      Dim cmbFrm As DropDownList = DirectCast(grdDeptEmp.Rows(e.RowIndex).FindControl("cmbFrm"), DropDownList)
      Dim cmbTo As DropDownList = DirectCast(grdDeptEmp.Rows(e.RowIndex).FindControl("cmbTo"), DropDownList)

      'SQLADR.Update(cmbFrm.SelectedValue, cmbTo.SelectedValue, Convert.ToInt32(lblEmpNo.Text))
      SQLADR.Update(cmbFrm.SelectedValue, cmbTo.SelectedValue)
      grdDeptEmp.EditIndex = -1
      FillGrid()

  End Sub
Posted
Updated 10-Jul-11 21:28pm
v2
Comments
Prerak Patel 11-Jul-11 3:30am    
You are doing it wrong.

1 solution

Check how to use SQLDataAdapter.Update
http://support.microsoft.com/kb/308055[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900