Hi,
I will paste my small code here..
Public Function Save_Product(ByVal ds As DAL.DSMain) As DataSet
Dim objDataSetChanges As DAL.DSMain = New DAL.DSMain()
Dim myDS As DataSet
objDataSetChanges = CType(ds.GetChanges(), DAL.DSMain)
If (Not (objDataSetChanges) Is Nothing) Then
Save_Dataset(objDataSetChanges)
objDataSetChanges.AcceptChanges()
End If
End Function
When I first the function it good but when i run again i got an error encountered
Error:
Object reference not set to an instance of an object.
Private Sub Save_Dataset(ByVal ChangedRows As DAL.DSMain)
Dim DA_Product As SqlDataAdapter = New SqlDataAdapter()
Dim DA_ProductItem As SqlDataAdapter = New SqlDataAdapter()
Dim DA_ProductAcc As SqlDataAdapter = New SqlDataAdapter()
DA_Product.InsertCommand = cmdInsert_Product()
DA_Product.UpdateCommand = cmdUpdate_Product()
DA_Product.DeleteCommand = cmdDelete_Product()
DA_ProductItem.InsertCommand = cmdInsert_ProductItem()
DA_ProductItem.UpdateCommand = cmdUpdate_ProductItem()
DA_ProductItem.DeleteCommand = cmdDelete_ProductItem()
DA_ProductAcc.InsertCommand = cmdInsert_ProductAcc()
DA_ProductAcc.UpdateCommand = cmdUpdate_ProductAcc()
DA_ProductAcc.DeleteCommand = cmdDelete_ProductAcc()
If (Not (ChangedRows) Is Nothing) Then
Try
SQLConn.SQLConn.Open()
DA_Product.Update(ChangedRows, "Product")
DA_ProductItem.Update(ChangedRows, "ProductItem")
DA_ProductAcc.Update(ChangedRows, "Product Accessories")
Catch ex As SystemException
ChangedRows.RejectChanges()
Throw ex
Finally
SQLConn.SQLConn.Close()
End Try
End If
End Sub
anybody can help me for this..
TIA
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement