In addition to Cathi's response:
Mufi,
The code you have posted looks okay, except for the myds.GpFilter.GetChanges(DataRowState.Modified) method call. It is not necessary because you are not assigning it's return value to a variable.
I suspect that the UpdateCommand is never being executed because all of the rows in GpFilter have a RowState of Unmodified. To test this, place a breakpoint before the Update call and look through the RowStates of all of the Rows in GpFilter. Or you could assign the result of the GetChanges method to a variable and see if it contains any rows.
Also, you might be seeing some undocumented behavior from GetChanges that resets all of the RowStates to Unmodified. I suspect this because the documentation is very explicit about merging the return value of GetChanges back into the original dataset.
>Mufi,
>
>One thing you can try it to look at SQL Profiler and see exactly what commands are being sent to the backend when you try to update your table.
>
>~~Bonnie
>
>
>>SQL PROCEDURE
>>
>>
>>SET QUOTED_IDENTIFIER ON
>>GO
>>SET ANSI_NULLS ON
>>GO
>>
>>ALTER Proc UpGpFilter
>>@Finame varchar(25)= null,
>>@Finameid int
>>AS
>>Update GpFilter
>>
>>Set Finame = @Finame
>>Where
>>Finameid = @Finameid
>>
>>GO
>>SET QUOTED_IDENTIFIER OFF
>>GO
>>SET ANSI_NULLS ON
>>GO
>>
>>
>>
>>
>>
>>
>>VB.NET CODE
>>
>>Private Sub UpdateRecord()
>> Try
>> Dim mycnn As New SqlConnection(ConnectionString)
>> dap1.UpdateCommand = New SqlCommand("UpGpFilter", mycnn)
>> With dap1.UpdateCommand
>> .CommandType = CommandType.StoredProcedure
>> .Parameters.Add("@Finame", SqlDbType.VarChar, 25, "Finame")
>> Dim prm1 As SqlParameter = dap1.UpdateCommand.Parameters.Add("@Finameid", SqlDbType.Int)
>> prm1.SourceColumn = "Finameid"
>> prm1.SourceVersion = DataRowVersion.Original
>> End With
>>
>> mycnn.Open()
>> myds.GpFilter.GetChanges(DataRowState.Modified)
>> dap1.Update(myds, "GpFilter")
>> mycnn.Close()
>>
>> Catch ex As SqlException
>> MsgBox(ex.Message, MsgBoxStyle.Critical, "SQL ERROR")
>>
>> Catch ex As Exception
>> MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
>>
>> End Try
>>
>> End Sub
>>
>>