getting System.NullReferenceException

G

Guest

H

I want to merge two dataset
When select command of data adapter(which is linked to dataset1) doesn’t return any resul
dataset1.Merger(dataset2, true) statement throws “System.NullReferenceException†exceptio

How can I make sure dataset1 is not null

Thanks for help in advance
 
W

William Ryan eMVP

Make sure that you instantiate both of them.. = new DataSet

and then you can check with using Is Nothing (I take it you are in VB.NET?)

If (Not DataSet1 Is Nothing) Then 'May want to verify dataset2 as well
dataSet1.Merge(dataSEt2, true)

End If
SM said:
Hi

I want to merge two dataset.
When select command of data adapter(which is linked to dataset1) doesn't return any result
dataset1.Merger(dataset2, true) statement throws
"System.NullReferenceException" exception
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top