for the sake of args

Discussion in 'ASP .Net' started by =?Utf-8?B?cm9kY2hhcg==?=, Oct 18, 2006.

  1. 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
    =?Utf-8?B?cm9kY2hhcg==?=, Oct 18, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?cm9kY2hhcg==?=

    Steven Nagy Guest

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

    rodchar wrote:
    > 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
    Steven Nagy, Oct 18, 2006
    #2
    1. Advertising

  3. thank you Steven. This helped.

    "Steven Nagy" wrote:

    >
    > 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;
    > }
    >
    > rodchar wrote:
    > > 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

    >
    >
    =?Utf-8?B?cm9kY2hhcg==?=, Oct 18, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Varn
    Replies:
    2
    Views:
    622
    Ken Varn
    Jun 22, 2005
  2. Ulrich Eckhardt
    Replies:
    3
    Views:
    338
  3. Replies:
    3
    Views:
    489
    David Eppstein
    Sep 17, 2003
  4. Pierre Fortin

    args v. *args passed to: os.path.join()

    Pierre Fortin, Sep 18, 2004, in forum: Python
    Replies:
    2
    Views:
    681
    Pierre Fortin
    Sep 18, 2004
  5. Pat Maddox
    Replies:
    2
    Views:
    112
    David Masover
    Aug 3, 2008
Loading...

Share This Page