We help IT Professionals succeed at work.

Dataset - Null reference exception ..! How to remove this warning

chokka
chokka asked
on
objDs is a variable name of the Dataset

Warning      1      Variable 'objDs' is used before it has been assigned a value. A null reference exception could result at runtime.      
Comment
Watch Question

Top Expert 2015
Commented:
You could initialize as Nothing.
Dim objDs As Object = Nothing
In VB, do this:
Dim objDs As DataSet = New DataSet()

In C#:
DataSet objDs = new DataSet();
chokkaStudent

Author

Commented:
thanks