When a function returns a datatable, does it just return a pointer to a datatable? I mean is the below example, which method to load a DataGrid would be better (1 or 2)? Are both equally efficient and accepted use of a function and datatable? (using pseudo-code here)
Code:Function GetData() as DataTable Dim myDataTable as New DataTable cn.Open() rSQLReader = cmd.ExecuteReader myDataTable.Load(rSQLReader) cn.Close() Return myDataTable End Function Sub LoadDataGrid1() Dim dt as New DataTable dt = GetData() myDataGrid.DataSource = dt End Sub Sub LoadDataGrid2() myDataGrid.DataSource = GetData() End Sub


Reply With Quote
