使用新行vb.net传递DataRow集合时,更新需要有效的InsertCommand吗?

时间:2018-01-05 07:59:47

标签: asp.net vb.net

我收到以下错误:

  

更新在传递DataRow集合时需要有效的InsertCommand   新行

我不知道它为什么会发生。它发生在其他部分。

Using ta As New dsUsersTableAdapters.wsm_Contact_UserTableAdapter
    ta.FillByContactID(dsContactUser.wsm_Contact_User, p_User.ContactID)
    If dsContactUser.wsm_Contact_User.Rows.Count > 0 Then
        dsContactUserrow = dsContactUser.wsm_Contact_User.Rows(0)
        With dsContactUserrow
            .Active = p_User.Active
            .UserType = p_User.UserType
            .UserID = p_User.UserID
            .Answer = p_User.Answer
            .QuestionID = p_User.QuestionID
            .ExtUser = p_User.ExtUser
            .Locked = p_User.Locked
        End With
    Else
        dsContactUserrow = dsContactUser.wsm_Contact_User.Newwsm_Contact_UserRow
        With dsContactUserrow
            .ContactID = p_User.ContactID
            .UserID = p_User.UserID
            .Active = p_User.Active
            .UserType = p_User.UserType
            .Password = p_User.Password
            .Answer = p_User.Answer
            .QuestionID = p_User.QuestionID
            .ExtUser = p_User.ExtUser
            .Locked = p_User.Locked
        End With
        dsContactUser.wsm_Contact_User.Addwsm_Contact_UserRow(dsContactUserrow)
    End If

    ta.Update(dsContactUser.wsm_Contact_User)
End Using

0 个答案:

没有答案