ASP and SQL Statements

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron

    ASP and SQL Statements

    Hey,
    I have a (hopefully) simple question that has been giving me some
    problems. I'm trying to use a simple Select statement to access some
    data in an access database.
    In access, the sql statement is as follows:

    SELECT TPL_Checklist_M aster.[1] From TPL_Checklist_M aster

    However, when I try to do this on an ASP Page, it always causes an
    error. I'm assuming this is because of the [] around the field name 1.
    (I would change the field names, but I don't have control over that).

    I know when trying to use a * in the statement Where field LIKE 'A*' I
    needed to replace the * with a %. I was wondering if something similar
    had to be done in this case.
    I hope my description is clear enought to follow. Thanks in advance
    for any help.
  • Ray at

    #2
    Re: ASP and SQL Statements

    What error are you getting?

    Ray at work

    "Aaron" <aarondouglas28 @hotmail.com> wrote in message
    news:16c3be6d.0 401061200.135ee edd@posting.goo gle.com...[color=blue]
    > Hey,
    > I have a (hopefully) simple question that has been giving me some
    > problems. I'm trying to use a simple Select statement to access some
    > data in an access database.
    > In access, the sql statement is as follows:
    >
    > SELECT TPL_Checklist_M aster.[1] From TPL_Checklist_M aster
    >
    > However, when I try to do this on an ASP Page, it always causes an
    > error. I'm assuming this is because of the [] around the field name 1.
    > (I would change the field names, but I don't have control over that).
    >
    > I know when trying to use a * in the statement Where field LIKE 'A*' I
    > needed to replace the * with a %. I was wondering if something similar
    > had to be done in this case.
    > I hope my description is clear enought to follow. Thanks in advance
    > for any help.[/color]


    Comment

    • Ray at

      #3
      Re: ASP and SQL Statements

      Oh, and what kind of database is it?

      Ray at work

      "Aaron" <aarondouglas28 @hotmail.com> wrote in message
      news:16c3be6d.0 401061200.135ee edd@posting.goo gle.com...[color=blue]
      > Hey,
      > I have a (hopefully) simple question that has been giving me some
      > problems. I'm trying to use a simple Select statement to access some
      > data in an access database.
      > In access, the sql statement is as follows:
      >
      > SELECT TPL_Checklist_M aster.[1] From TPL_Checklist_M aster
      >
      > However, when I try to do this on an ASP Page, it always causes an
      > error. I'm assuming this is because of the [] around the field name 1.
      > (I would change the field names, but I don't have control over that).
      >
      > I know when trying to use a * in the statement Where field LIKE 'A*' I
      > needed to replace the * with a %. I was wondering if something similar
      > had to be done in this case.
      > I hope my description is clear enought to follow. Thanks in advance
      > for any help.[/color]


      Comment

      • Steve Lutz

        #4
        Re: ASP and SQL Statements

        Aaron,

        For starters, try changing your select statement to "select * from
        TPL_Checklist_M aster" Does that work?


        I'm a little confussed on what the [1] is, is there really a column named
        "1" in the database.

        You could also just try "Select [1] from TPL_Checklist_M aster"


        Hope this helps


        Steve





        "Aaron" <aarondouglas28 @hotmail.com> wrote in message
        news:16c3be6d.0 401061200.135ee edd@posting.goo gle.com...[color=blue]
        > Hey,
        > I have a (hopefully) simple question that has been giving me some
        > problems. I'm trying to use a simple Select statement to access some
        > data in an access database.
        > In access, the sql statement is as follows:
        >
        > SELECT TPL_Checklist_M aster.[1] From TPL_Checklist_M aster
        >
        > However, when I try to do this on an ASP Page, it always causes an
        > error. I'm assuming this is because of the [] around the field name 1.
        > (I would change the field names, but I don't have control over that).
        >
        > I know when trying to use a * in the statement Where field LIKE 'A*' I
        > needed to replace the * with a %. I was wondering if something similar
        > had to be done in this case.
        > I hope my description is clear enought to follow. Thanks in advance
        > for any help.[/color]


        Comment

        • Aaron

          #5
          Re: ASP and SQL Statements

          Hey all,
          Thanks for your help and I'm sorry for any confusion. A little more
          background.
          Yes, 1 is a column in the database. There are several columns that
          simply have numbers for the name. Unfortunately, i have no control
          over this aspect of the database. It is also an access database.
          The error that I'm receiving is as follows:

          Error Type:
          ADODB.Recordset (0x800A0BB9)
          Arguments are of the wrong type, are out of acceptable range, or are
          in conflict with one another.

          The reasoning for the brackets around the field name is that, when
          writing the query in access, it seems that it does not like to simply
          use a number as a field name, but if you put brackets around it, it
          works fine (can someone explain the reasoning behind this to me?). The
          problem is, that when I include the brackets in the SQL statement in
          an ASP Page, I get the above error.
          If anyone can shed some light on a solution I would very much
          appreciate it.

          Thanks for you time,
          Aaron


          "Steve Lutz" <slutz@comcast. net> wrote in message news:<eyVMSPJ1D HA.3436@tk2msft ngp13.phx.gbl>. ..[color=blue]
          > Aaron,
          >
          > For starters, try changing your select statement to "select * from
          > TPL_Checklist_M aster" Does that work?
          >
          >
          > I'm a little confussed on what the [1] is, is there really a column named
          > "1" in the database.
          >
          > You could also just try "Select [1] from TPL_Checklist_M aster"
          >
          >
          > Hope this helps
          >
          >
          > Steve
          >
          >
          >
          >
          >
          > "Aaron" <aarondouglas28 @hotmail.com> wrote in message
          > news:16c3be6d.0 401061200.135ee edd@posting.goo gle.com...[color=green]
          > > Hey,
          > > I have a (hopefully) simple question that has been giving me some
          > > problems. I'm trying to use a simple Select statement to access some
          > > data in an access database.
          > > In access, the sql statement is as follows:
          > >
          > > SELECT TPL_Checklist_M aster.[1] From TPL_Checklist_M aster
          > >
          > > However, when I try to do this on an ASP Page, it always causes an
          > > error. I'm assuming this is because of the [] around the field name 1.
          > > (I would change the field names, but I don't have control over that).
          > >
          > > I know when trying to use a * in the statement Where field LIKE 'A*' I
          > > needed to replace the * with a %. I was wondering if something similar
          > > had to be done in this case.
          > > I hope my description is clear enought to follow. Thanks in advance
          > > for any help.[/color][/color]

          Comment

          • Ray at

            #6
            Re: ASP and SQL Statements

            What kind of database?

            Ray at work

            "Aaron" <aarondouglas28 @hotmail.com> wrote in message
            news:16c3be6d.0 401070608.42888 c84@posting.goo gle.com...[color=blue]
            > Hey all,
            > Thanks for your help and I'm sorry for any confusion. A little more
            > background.
            > Yes, 1 is a column in the database. There are several columns that
            > simply have numbers for the name. Unfortunately, i have no control
            > over this aspect of the database. It is also an access database.
            > The error that I'm receiving is as follows:
            >
            > Error Type:
            > ADODB.Recordset (0x800A0BB9)
            > Arguments are of the wrong type, are out of acceptable range, or are
            > in conflict with one another.
            >
            > The reasoning for the brackets around the field name is that, when
            > writing the query in access, it seems that it does not like to simply
            > use a number as a field name, but if you put brackets around it, it
            > works fine (can someone explain the reasoning behind this to me?). The
            > problem is, that when I include the brackets in the SQL statement in
            > an ASP Page, I get the above error.
            > If anyone can shed some light on a solution I would very much
            > appreciate it.
            >
            > Thanks for you time,
            > Aaron
            >
            >
            > "Steve Lutz" <slutz@comcast. net> wrote in message[/color]
            news:<eyVMSPJ1D HA.3436@tk2msft ngp13.phx.gbl>. ..[color=blue][color=green]
            > > Aaron,
            > >
            > > For starters, try changing your select statement to "select * from
            > > TPL_Checklist_M aster" Does that work?
            > >
            > >
            > > I'm a little confussed on what the [1] is, is there really a column[/color][/color]
            named[color=blue][color=green]
            > > "1" in the database.
            > >
            > > You could also just try "Select [1] from TPL_Checklist_M aster"
            > >
            > >
            > > Hope this helps
            > >
            > >
            > > Steve
            > >
            > >
            > >
            > >
            > >
            > > "Aaron" <aarondouglas28 @hotmail.com> wrote in message
            > > news:16c3be6d.0 401061200.135ee edd@posting.goo gle.com...[color=darkred]
            > > > Hey,
            > > > I have a (hopefully) simple question that has been giving me some
            > > > problems. I'm trying to use a simple Select statement to access some
            > > > data in an access database.
            > > > In access, the sql statement is as follows:
            > > >
            > > > SELECT TPL_Checklist_M aster.[1] From TPL_Checklist_M aster
            > > >
            > > > However, when I try to do this on an ASP Page, it always causes an
            > > > error. I'm assuming this is because of the [] around the field name 1.
            > > > (I would change the field names, but I don't have control over that).
            > > >
            > > > I know when trying to use a * in the statement Where field LIKE 'A*' I
            > > > needed to replace the * with a %. I was wondering if something similar
            > > > had to be done in this case.
            > > > I hope my description is clear enought to follow. Thanks in advance
            > > > for any help.[/color][/color][/color]


            Comment

            • Aaron

              #7
              Re: ASP and SQL Statements

              Nevermind....yo u can call me a dumb***.... got the name of the
              connection variable wrong in the open statement, transposed 2
              letters....I love wasting time on stupid mistakes....
              Thanks again for your help


              "Steve Lutz" <slutz@comcast. net> wrote in message news:<eyVMSPJ1D HA.3436@tk2msft ngp13.phx.gbl>. ..[color=blue]
              > Aaron,
              >
              > For starters, try changing your select statement to "select * from
              > TPL_Checklist_M aster" Does that work?
              >
              >
              > I'm a little confussed on what the [1] is, is there really a column named
              > "1" in the database.
              >
              > You could also just try "Select [1] from TPL_Checklist_M aster"
              >
              >
              > Hope this helps
              >
              >
              > Steve
              >
              >
              >
              >
              >
              > "Aaron" <aarondouglas28 @hotmail.com> wrote in message
              > news:16c3be6d.0 401061200.135ee edd@posting.goo gle.com...[color=green]
              > > Hey,
              > > I have a (hopefully) simple question that has been giving me some
              > > problems. I'm trying to use a simple Select statement to access some
              > > data in an access database.
              > > In access, the sql statement is as follows:
              > >
              > > SELECT TPL_Checklist_M aster.[1] From TPL_Checklist_M aster
              > >
              > > However, when I try to do this on an ASP Page, it always causes an
              > > error. I'm assuming this is because of the [] around the field name 1.
              > > (I would change the field names, but I don't have control over that).
              > >
              > > I know when trying to use a * in the statement Where field LIKE 'A*' I
              > > needed to replace the * with a %. I was wondering if something similar
              > > had to be done in this case.
              > > I hope my description is clear enought to follow. Thanks in advance
              > > for any help.[/color][/color]

              Comment

              Working...