akhil_jain103
New member
- Joined
- Jan 5, 2018
- Messages
- 1
- Programming Experience
- Beginner
am getting the folowing error Update requires a valid InsertCommand when passed DataRow collection with new rows and i have no idea why it's happening it's happening in else part.!!please need help no idea why it's happening
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
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