Hello!!
Below I have some methods that first setup a select string then read the
dataset into a ArrayList.
I have used the Data Adaper ConfigurationWizard for these adapter that I use
here.
I just wonder if it's possible to use inheritance and polymorfism or some
other construction here to minimize that code.
private void loadComposition()
{
DataSet dSMspComposition = new DataSet();
OleDbDataAdapter mspCompositionAdapter=
MeltPracStorage.instance.mspCompositionAdapter;
mspCompositionAdapter.SelectCommand.CommandText = "select distinct
comp_name from msp_comp";
mspCompositionAdapter.Fill(dSMspComposition);
foreach (DataRow row in dSMspComposition.Tables[0].Rows)
compositionList.Add(row["COMP_NAME"]);
}
private void loadCorrectionsAndAlloys()
{
DataSet dSMspCorrections = new DataSet();
OleDbDataAdapter mspCorrectionsAdapter =
MeltPracStorage.instance.mspCorrectionsAdapter;
mspCorrectionsAdapter.SelectCommand.CommandText = "select distinct
corr_name from msp_corr";
mspCorrectionsAdapter.Fill(dSMspCorrections);
foreach (DataRow row in dSMspCorrections.Tables[0].Rows)
correctionsList.Add(row["CORR_NAME"]);
}
private void loadDesulph()
{
DataSet dSMspDesulph = new DataSet();
OleDbDataAdapter mspDesulphAdapter =
MeltPracStorage.instance.mspDesulphAdapter;
mspDesulphAdapter.SelectCommand.CommandText = "select distinct des_name
from msp_desulph";
mspDesulphAdapter.Fill(dSMspDesulph);
foreach (DataRow row in dSMspDesulph.Tables[0].Rows)
desulphList.Add(row["DES_NAME"]);
}
private void loadMetallurgical()
{
DataSet dSMspMetallurgical = new DataSet();
OleDbDataAdapter mspMetallurgicalAdapter =
MeltPracStorage.instance.mspMetParAdapter;
mspMetallurgicalAdapter.SelectCommand.CommandText = "select distinct
metpar_name from msp_metpar";
mspMetallurgicalAdapter.Fill(dSMspMetallurgical);
foreach (DataRow row in dSMspMetallurgical.Tables[0].Rows)
metallurgicalList.Add(row["METPAR_NAME"]);
}
private void loadTimes()
{
DataSet dSMspTimes = new DataSet();
OleDbDataAdapter mspTimesAdapter =
MeltPracStorage.instance.mspTimeParAdapter;
mspTimesAdapter.SelectCommand.CommandText = "select distinct
timepar_name from msp_timepar";
mspTimesAdapter.Fill(dSMspTimes);
foreach (DataRow row in dSMspTimes.Tables[0].Rows)
timesList.Add(row["TIMEPAR_NAME"]);
}
private void loadMisc()
{
DataSet dSMspMisc = new DataSet();
OleDbDataAdapter mspMiscAdapter =
MeltPracStorage.instance.mspMiscParAdapter;
mspMiscAdapter.SelectCommand.CommandText = "select distinct miscpar_name
from msp_miscpar";
mspMiscAdapter.Fill(dSMspMisc);
foreach (DataRow row in dSMspMisc.Tables[0].Rows)
miscList.Add(row["MISCPAR_NAME"]);
}
private void loadCovLadleList()
{
DataSet dSMspCovLadle = new DataSet();
OleDbDataAdapter mspCovLadleAdapter =
MeltPracStorage.instance.mspCovLadleParAdapter;
mspCovLadleAdapter.SelectCommand.CommandText = "select distinct
covladle_name from msp_covladle";
mspCovLadleAdapter.Fill(dSMspCovLadle);
foreach (DataRow row in dSMspCovLadle.Tables[0].Rows)
covLadleList.Add(row["COVLADLE_NAME"]);
}
//Tony