Hi all
Am attempting to update a database table after making changes to the table by using the following code:
I am however getting the following error:
Any suggestions??
Mike55.
Am attempting to update a database table after making changes to the table by using the following code:
Code:
Public Function UpdDataSet(ByVal memberID As Int16, ByVal GroupID As Int16, ByVal OrgID As String, ByVal dataset As DataSet)
Dim daDataAdapter As New SqlClient.SqlDataAdapter
Dim nRow As DataRow
nRow = dataset.Tables("GroupMembership").NewRow
nRow("Member_ID") = memberID
nRow("Group_ID") = GroupID
nRow("Org_ID") = OrgID
dataset.Tables("GroupMembership").Rows.Add(nRow)
Dim cncon As New SqlConnection(clsConnection.osqlStr)
cncon.Open()
daDataAdapter.Update(dataset, "GroupMembership")
If cncon.State = ConnectionState.Open Then
cncon.Close()
End If
End Function
I am however getting the following error:
Code:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: Update requires a valid InsertCommand when passed DataRow collection with new rows. at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at SureTxtWebService.dsMember.UpdDataSet(Int16 memberID, Int16 GroupID, String OrgID, DataSet dataset) in C:\SureTxtProject\SureTxtWebSolution\SureTxtWebService\Modules\dsMember.vb:line 87 at SureTxtWebService.wsMember.UpdDataSet(Int16 memberID, Int16 groupID, String orgID, DataSet dsRecords) in C:\SureTxtProject\SureTxtWebSolution\SureTxtWebService\wsMember.asmx.vb:line 50 --- End of inner exception stack trace ---
Any suggestions??
Mike55.