Web Development



Can we use Array Variable to save query in VB.net?

By Vayrella ·
I put a query in a function, and I need new query when the function is called.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Not too clear there mate

by Tony Hopkinson In reply to Can we use Array Variable ...

I can think of several things you could be asking.

Don't know which one you mean though.

If you are talking about building a query from an array, (e.g a number of columns to select), or a number of values for a where clause, remember these.

There could be none or one or effectively unlimited.

The order of the items..

If your query is
Where A = Value[0] or A = Value[1]

no problem.

if it were
Where A = Value[0] or B = Value[1]

It's isn't an array. For that sort of thing you'd be better off with a Dictionary. Go too far down that route though and you've just reinvented SQL.

Personally I'd write a function for each query unless there was some major design consideration not to. Give them nice names. Easier to read , change and debug.

I six months time when you have to revisit this code. Do you want to see

DoQuery(["Fred", "Wilma"])


GetChildren(Husband, Wife)

Related Discussions

Related Forums