Hi There
I Have A Datagrid That I Use To Fill An Invoice With ItemID, Description,Qunty,Price.
Saving And Retrieving The Invoice to and from SQL Server Is POC
How Can I Mark The Modification On Each row Or a Deleted Row , So That When I Save My Work The Software Would Recognise The Update That Has Been Done And Perform The Condition Given Correctly
my Condition In My Code That I Have Assigned In The Save Mode Are
I Have A Datagrid That I Use To Fill An Invoice With ItemID, Description,Qunty,Price.
Saving And Retrieving The Invoice to and from SQL Server Is POC
How Can I Mark The Modification On Each row Or a Deleted Row , So That When I Save My Work The Software Would Recognise The Update That Has Been Done And Perform The Condition Given Correctly
my Condition In My Code That I Have Assigned In The Save Mode Are
Code:
For Each row In InvDataSet1.Tables(0).Rows
Assign Values To All Parameters And Excute Querry
With MyComm
.Parameters("@InvNum").Value = CInt(txtInvID.Text)
.Parameters("@ItemID").Value = row.Item(1)
.Parameters("@InvQunty").Value = row.Item(2)
.Parameters("@ItemPrice").Value = row.Item(3)
.Parameters("@InvVAT").Value = row.Item(4)
End With
If row.RowState = DataRowState.Added Then
MyComm.CommandText = "NewInvLine"
ElseIf row.RowState = DataRowState.Modified Then
MyComm.CommandText = "UpdateInvLine"
ElseIf row.RowState = DataRowState.Deleted Then
MyComm.CommandText = "DeleteInvLine"
ElseIf row.RowState = DataRowState.Unchanged Then
MyComm.CommandText = "UpdateInvLine"
End If
MyComm.ExecuteNonQuery()
[\Code]
Thank You In Advance
:confused: