ASP and SQL Statements

A

Aaron

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_Master.[1] From TPL_Checklist_Master

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.
 
A

Aaron

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 said:
Aaron,

For starters, try changing your select statement to "select * from
TPL_Checklist_Master" 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_Master"


Hope this helps


Steve





Aaron said:
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_Master.[1] From TPL_Checklist_Master

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.
 
R

Ray at

What kind of database?

Ray at work

Aaron said:
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" <[email protected]> wrote in message
Aaron,

For starters, try changing your select statement to "select * from
TPL_Checklist_Master" 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_Master"


Hope this helps


Steve





Aaron said:
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_Master.[1] From TPL_Checklist_Master

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.
 
A

Aaron

Nevermind....you 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 said:
Aaron,

For starters, try changing your select statement to "select * from
TPL_Checklist_Master" 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_Master"


Hope this helps


Steve





Aaron said:
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_Master.[1] From TPL_Checklist_Master

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.
 

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

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top