Dim Command Question

K

Keith

Good Morning,

I am new to .Net so forgive me if this is question is kind of out there. Is there a way to consolidate multiple Dim statements for Sql Commands? I have a page that has around 50 Dim statements for Sql Commands and was wondering if there was a way much like an array where I could just do something like:

Dim cmdSelect(50) as Sql Command

This may be far fetched, but just thought I would ask.

Thanks,
Keith
 
H

Hermit Dave

i am not sure whether you need all the 50 commands at the same time !!!
if you dont i would advise you to have an array of sql command text and then
use something like Microsoft Data Access Application Block to create the
corresponding amout.
Even then i am not sure whether this is the best advice. If you could write
a bit more on what you are trying to achieve, maybe someone around here will
be able to answer your question in a better way.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
Good Morning,

I am new to .Net so forgive me if this is question is kind of out there. Is
there a way to consolidate multiple Dim statements for Sql Commands? I have
a page that has around 50 Dim statements for Sql Commands and was wondering
if there was a way much like an array where I could just do something like:

Dim cmdSelect(50) as Sql Command

This may be far fetched, but just thought I would ask.

Thanks,
Keith
 
K

Keith

I have a page that where someone can select a date (JAN 04) from a dropdown
list. When they click submit it returns the given results for 5 different
locations (Just simple Select statements). So I would say I need all those
commands at the same time. Right now I have the following:

Dim cmdSelect1 as SqlCommand
Dim cmdSelect2 as SqlCommand
etc
etc

Thanks,
 
K

Karl Seguin

You can have an array of SqlCommands, or you could simply keep reusing the same name and reinstantiate it

dim command as SqlCommand
for i as integer = 0 to 50
command = new SqlCommand()

command.dispose()
next i

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Good Morning,

I am new to .Net so forgive me if this is question is kind of out there. Is there a way to consolidate multiple Dim statements for Sql Commands? I have a page that has around 50 Dim statements for Sql Commands and was wondering if there was a way much like an array where I could just do something like:

Dim cmdSelect(50) as Sql Command

This may be far fetched, but just thought I would ask.

Thanks,
Keith
 
H

Hermit Dave

consider using a stored procedure instead of direct select commands and you
can get multiple recordsets

as long as the datasource is the same you select command can indeed return
more than one recordsets

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
K

Keith

Thanks for everyone's input.
You can have an array of SqlCommands, or you could simply keep reusing the same name and reinstantiate it

dim command as SqlCommand
for i as integer = 0 to 50
command = new SqlCommand()

command.dispose()
next i

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Good Morning,

I am new to .Net so forgive me if this is question is kind of out there. Is there a way to consolidate multiple Dim statements for Sql Commands? I have a page that has around 50 Dim statements for Sql Commands and was wondering if there was a way much like an array where I could just do something like:

Dim cmdSelect(50) as Sql Command

This may be far fetched, but just thought I would ask.

Thanks,
Keith
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top