Last post Nov 30, 2013 08:30 PM by oned_gk
Nov 25, 2013 02:27 AM|ogsim07|LINK
I am having confusions regaqrding use of 'new' keyword:-
1) when useing a data reader; why dont we have to use: Dim rdr as new datareader=cmd.executeReader() ?
2) when we are creating a new DataRow, we cannot use Dim dr As New DataRow?
Nov 25, 2013 02:32 AM|XIII|LINK
the new keyword is being used to spawn up a new object, basically an instance of a given class.
As ExecuteReader already provides an instance/object, rdr will reference that object hence no need for the use of New here.
For 2 the constructor is marked Internal and as suggested is only to be used by framework classes not by you.
The way to create a new DataRow is to make a DataTable first and there use the method NewRow() as explained in
Nov 30, 2013 08:30 PM|oned_gk|LINK