TiltingCode
Programmer
I have the below code:
Is it okay that I'm returning a dataTable without destroying the object? I've been told that the garbage collector will take care of this but I want to write efficient code.
The above code will be used multiple times through out the application. If this isn't efficient can someone please help out on what I should do?
The dataset can consist of many records.
Thnx much
Code:
public DataTable RSValues(string strSP, string strID, int intStatus, int intProcessID)
{
SqlDataAdapter DataAdapter = new SqlDataAdapter(strSP + " " + intProcessID + ", " + intStatus, strConnection);
DataSet RS = new DataSet();
DataAdapter.Fill(RS);
System.Data.DataTable datTable = RS.Tables[0];
return datTable;
}
Is it okay that I'm returning a dataTable without destroying the object? I've been told that the garbage collector will take care of this but I want to write efficient code.
The above code will be used multiple times through out the application. If this isn't efficient can someone please help out on what I should do?
The dataset can consist of many records.
Thnx much