for the sake of args

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
 
S

Steven Nagy

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;
}
 
G

Guest

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;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top