demouser
demouser

Reputation: 113

Assign columns to datatable when it is null

Hi all I am declaring my datatable as DataTable dt=null I would like to add columns to this datatable with out declaring it as dt=new DataTable(); is it possible to do this

Upvotes: 0

Views: 85

Answers (1)

Sachin
Sachin

Reputation: 40970

is it possible to do this?

Answer : No

You can't access or use an object if it is null. You will get an null reference exception.

object reference not set to an instance of an object.

Upvotes: 1

Related Questions