Dim Command Question

Discussion in 'ASP .Net' started by Keith, Sep 29, 2004.

  1. Keith

    Keith Guest

    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
    Keith, Sep 29, 2004
    #1
    1. Advertising

  2. Keith

    Hermit Dave Guest

    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)
    "Keith" <> wrote in message
    news:...
    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
    Hermit Dave, Sep 29, 2004
    #2
    1. Advertising

  3. Keith

    Keith Guest

    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,

    "Hermit Dave" <> wrote in message
    news:...
    > 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)
    > "Keith" <> wrote in message
    > news:...
    > 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
    >
    >
    Keith, Sep 29, 2004
    #3
  4. Keith

    Karl Seguin Guest

    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/


    "Keith" <> wrote in message news:...
    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
    Karl Seguin, Sep 29, 2004
    #4
  5. Keith

    Hermit Dave Guest

    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)
    "Keith" <> wrote in message
    news:OEqNS%...
    >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,
    >
    > "Hermit Dave" <> wrote in message
    > news:...
    >> 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)
    >> "Keith" <> wrote in message
    >> news:...
    >> 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
    >>
    >>

    >
    >
    Hermit Dave, Sep 29, 2004
    #5
  6. Keith

    Keith Guest

    Thanks for everyone's input.
    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:...
    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/


    "Keith" <> wrote in message news:...
    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
    Keith, Sep 29, 2004
    #6
    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. VB Programmer
    Replies:
    3
    Views:
    400
    Chris Mahoney
    Jul 13, 2003
  2. Andreas Klemt
    Replies:
    1
    Views:
    451
    Steve C. Orr, MCSD
    Jul 23, 2003
  3. gce
    Replies:
    2
    Views:
    3,242
  4. Denis Palas
    Replies:
    1
    Views:
    501
  5. Florian Kaufmann
    Replies:
    1
    Views:
    377
Loading...

Share This Page