473,320 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

for the sake of args

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
Oct 18 '06 #1
2 929

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
Oct 18 '06 #2
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

Oct 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John J. Lee | last post by:
I'm trying define a class to act as a Mock "handler" object for testing urllib2.OpenerDirector. OpenerDirector (actually, my copy of it) does dir(handler.__class__) to find out what methods a...
2
by: Jim Jewett | last post by:
Normally, I expect a subclass to act in a manner consistent with its Base classes. In particular, I don't expect to *lose* any functionality, unless that was the whole point of the subclass. ...
6
by: Peter Kleiweg | last post by:
I'm still new to Python. All my experience with OO programming is in a distant past with C++. Now I have written my first class in Python. The class behaves exactly as I want, but I would like to...
2
by: Pierre Fortin | last post by:
This quest for understanding started very innocently... A simple error on my part, passing on args as "args" instead of "*args" to os.path.join() led me to wonder why an error wasn't raised... ...
15
by: Stefan Behnel | last post by:
Hi! I'm trying to do this in Py2.4b1: ------------------------------- import logging values = {'test':'bla'} logging.log(logging.FATAL, 'Test is %(test)s', values)...
10
by: Steven Bethard | last post by:
So, as I understand it, in Python 3000, zip will basically be replaced with izip, meaning that instead of returning a list, it will return an iterator. This is great for situations like: zip(*)...
1
by: Andreas Beyer | last post by:
Hi, If an exception gets raised while I am parsing an input file I would like to know where (in which line) the error occured. I do not want to create my own exception class for that purpose and...
27
by: TheDD | last post by:
Hello all, right now, i'm using the following macro to automatically add informations to exceptions: #define THROW(Class, args...) throw Class(__FILE__, __LINE__, ## args) but AFAIK, it's...
18
by: Joel Hedlund | last post by:
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning...
5
by: Guillermo | last post by:
Hi, This must be very basic, but how'd you pass the same *args several levels deep? def func2(*args) print args # ((1, 2, 3),) # i want this to output (1, 2, 3) as func1!
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.