Hello!
This method below works but how can it work when I don't have any open on
myOleDbConnection ?
As I have understood this is that there must exist an myOleDbConnection
..Open(); in my case
but it works just as good with one as without one.
public ArrayList GetAllPostNames()
{
// here I get the connection from a singleton in a class library dll
OleDbConnection myOleDbConnection =
MeltPracStorage.instance.utcasMspDbConnection;
DataSet dataSet = new DataSet();
ArrayList arrayList = new ArrayList();
OleDbDataAdapter myOleDbAdapter = new OleDbDataAdapter("select * "
+
"from MSP_COMP t1 " +
"where ACTIVE = 1 and " +
"SAVE_TIME = " +
"(select max(SAVE_TIME) " +
"from MSP_COMP " +
"where COMP_NAME = t1.COMP_NAME)
order by COMP_NAME", myOleDbConnection);
myOleDbAdapter.Fill( dataSet );
//loop through the dataset and add each COMP_NAME result to the
ArrayList and return it
foreach( DataRow row in dataSet.Tables[0].Rows)
arrayList.Add( row["COMP_NAME"] );
return arrayList;
}
//Tony