running vb.net 2003 & SQL 2005
I have the following function that is meant to add a row to a table... but
i keep getting an error and i dont understand why. Ive spent a couple of
days on this now, has anybody any suggestions ?
Error :-
'row' argument cannot be null.
Parameter name: row
Code :-
Private Manager As CurrencyManager
Public sLicence As String
Private Orig_Accounts As New DataSet
Private NewRow As DataRow
Private NewRecordFlag As Boolean = False
Private Function ValidateChanges ()
Manager.EndCurr entEdit()
If NewRecordFlag Then
Try
' THIS IS WHERE THE ERROR OCCOURS
Orig_Accounts.T ables("TBL_Orig Accounts").Rows .Add(NewRow)
Catch DBError As Exception
Console.WriteLi ne(DBError.Mess age)
Exit function
End Try
SetNewData()
NewRow = Orig_Accounts.T ables("TBL_Orig Accounts").NewR ow
BindControls()
End If
If Orig_Accounts.H asChanges(DataR owState.Modifie d) Then
If MsgBox("Update changes to Licence " & sLicence & " ?",
MsgBoxStyle.OKC ancel, "Profile Update") = MsgBoxResult.OK Then
Try
SQL_COMMANDBUIL DER.DataAdapter = SQL_DATAADAPTER
SQL_COMMANDBUIL DER.GetUpdateCo mmand()
SQL_DATAADAPTER .Update(Orig_Ac counts, "TBL_OrigAccoun ts")
Orig_Accounts.A cceptChanges()
Catch ex As Exception
' Tempory
MsgBox(ex.Messa ge)
End Try
End If
Else
If Orig_Accounts.H asChanges(DataR owState.Added) Then
SQL_COMMANDBUIL DER.DataAdapter = SQL_DATAADAPTER
SQL_COMMANDBUIL DER.GetUpdateCo mmand()
SQL_DATAADAPTER .Update(Orig_Ac counts, "TBL_OrigAccoun ts")
Orig_Accounts.A cceptChanges()
End If
End If
NewRecordFlag = False
End Function
I have the following function that is meant to add a row to a table... but
i keep getting an error and i dont understand why. Ive spent a couple of
days on this now, has anybody any suggestions ?
Error :-
'row' argument cannot be null.
Parameter name: row
Code :-
Private Manager As CurrencyManager
Public sLicence As String
Private Orig_Accounts As New DataSet
Private NewRow As DataRow
Private NewRecordFlag As Boolean = False
Private Function ValidateChanges ()
Manager.EndCurr entEdit()
If NewRecordFlag Then
Try
' THIS IS WHERE THE ERROR OCCOURS
Orig_Accounts.T ables("TBL_Orig Accounts").Rows .Add(NewRow)
Catch DBError As Exception
Console.WriteLi ne(DBError.Mess age)
Exit function
End Try
SetNewData()
NewRow = Orig_Accounts.T ables("TBL_Orig Accounts").NewR ow
BindControls()
End If
If Orig_Accounts.H asChanges(DataR owState.Modifie d) Then
If MsgBox("Update changes to Licence " & sLicence & " ?",
MsgBoxStyle.OKC ancel, "Profile Update") = MsgBoxResult.OK Then
Try
SQL_COMMANDBUIL DER.DataAdapter = SQL_DATAADAPTER
SQL_COMMANDBUIL DER.GetUpdateCo mmand()
SQL_DATAADAPTER .Update(Orig_Ac counts, "TBL_OrigAccoun ts")
Orig_Accounts.A cceptChanges()
Catch ex As Exception
' Tempory
MsgBox(ex.Messa ge)
End Try
End If
Else
If Orig_Accounts.H asChanges(DataR owState.Added) Then
SQL_COMMANDBUIL DER.DataAdapter = SQL_DATAADAPTER
SQL_COMMANDBUIL DER.GetUpdateCo mmand()
SQL_DATAADAPTER .Update(Orig_Ac counts, "TBL_OrigAccoun ts")
Orig_Accounts.A cceptChanges()
End If
End If
NewRecordFlag = False
End Function
Comment