开发者

vb.net linq update Data

Hi Guys thanks for all the help on things. Im using linq and im able get get data ouf of it realy easy. but i seem to not be able to update the data. the program does not error on it and it looks likes it has updated but it does not save te changes.

 Public Function UpdateAlarmsbyKey(ByVal objKey As Integer, ByVal IdNumber As String) As Boolean
    Dim lqAlarms As New linqAlarmDumpDataContext

    Dim GetAlrms = 开发者_开发知识库From r In lqAlarms.AlarmDrops _
                   Where r.Key = objKey _
                   Select r


    For Each Calls In GetAlrms

        If Calls.AlarmsHandled = "" Then
            Calls.AlarmsHandled = IdNumber
            Return True
        Else
            Calls.AlarmsHandled = Calls.AlarmsHandled & ":" & IdNumber
            Return True
        End If
    Next
    Return False

End Function


Try calling -

lqAlarms.SubmitChanges()

after you've updated the Calls.AlarmsHandled property. Also, your code is looping round a result set but will only change the first record it finds, is that the behaviour you wanted?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜