Complications trying to use Table Adapter

G

Guest

I'm using VS2005, VB, WinForms

I’ve developed forms using those nice wizards Microsoft provides. However,
I’m running into a couple of complications trying to work with the resulting
Table Adapters.

1) My user interface allows the user to fill in any combination of perhaps a
dozen Query-By-Example (QBE) fields, and then press a Query button to
generate a list, based on an SQL statement that incorporates those QBE
fields. The list is presented in a DataGridView.
I have ancestor code to generate a full SQL statement based on any
combination of QBE fields entered, including handling typical search symbols
(>, <=, *, etc.). How do I get the generated SQL into a Table Adapter Query?
It looks like Table Adapter Queries are designed to be set up only at design
time (?). I’ve tried to put the whole Where clause into a Parameter, but
this fails. Since the user can enter any combination of the 12 QBE fields it
is impractical to set up Queries to handle all possibilities at design time.

2) I’d like to pass the Table Adapter to parent objects (ancestors in the
same class) for generic save processing. Apparently, Table Adapters can’t be
defined any more precisely than as an Object (?), so I don’t see how to
assign them to an object variable that I can work with in the Ancestor.

So, do I forgo the lovely wizard and build my forms more from scratch, or
can I make Table Adapters flexible enough to handle my requirements?
 
C

Cor Ligthert [MVP]

Bruce,

As I understand your problem than it is all about the SQL Select string.

You can change that in any place in your program, by instance just before
the moment that you try to get the table.

However if it is not working as SQL statement, it will not work in the
tableadapter. I have some thoughts that this is in your situation what is
the reason it won't work.

Cor
 

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

Top