for the sake of args

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,
i have 2 tableadapters. is there any way to have 1 generic routine that will
return the correct datatable if i passed in a parm indicating which
tableadapter i want instanced, filled, and returned?

thanks,
rodchar
 
public enum Type {
FirstTable, SecondTable
}

public DataTable FillTable(Type type) {
DataTable datatable = new DataTable();
if (type==Type.FirstTable) { adapter1.Fill(datatable); }
else if (type==Type.SecondTable) { adapter2.Fill(datatable); }
return datatable;
}
 
thank you Steven. This helped.

Steven Nagy said:
public enum Type {
FirstTable, SecondTable
}

public DataTable FillTable(Type type) {
DataTable datatable = new DataTable();
if (type==Type.FirstTable) { adapter1.Fill(datatable); }
else if (type==Type.SecondTable) { adapter2.Fill(datatable); }
return datatable;
}
 
Back
Top