I'm trying to track down a .NET error in my little game here.
Here is the error:
ArgumentNullException: 'table' argument cannot be null
System.DataSet.Merge(DattaTable table)
It's occurring on the line below where it tries to merge a table into an existing dataset.
I'm trying to do as many checks as I think I can to determine if the dataset or table are empty, but it continues to error on the ds.Merge line.
Dim ds As DataSet
'getData = simple function that uses SqlConnection & SqlDataAdapter to get data from my database
ds = utils.getData("Sproc_GetGameEncounters")
Dim MonsterDataSet As DataSet
MonsterDataSet = utils.getData("Sproc_MonsterDataSetFromDB")
If Not MonsterDataSet Is Nothing Then
If MonsterDataSet.Tables("TreasureList") Is Nothing OrElse MonsterDataSet.Tables("TreasureList").Rows.Count = 0 Then
'MonsterDataSet.Tables("TreasureList") is empty
Else
ds.Merge(MonsterDataSet.Tables("TreasureList")) 'line where error occurs
End If
End If
Are there more checks I could add to help fix or at least track down this error?
Thanks!