|
 |
access_asp thread: Bad SQL quotes? -- I get error '80020009'
Message #1 by "Omar Esquivel" <omare@u...> on Mon, 22 Jul 2002 16:32:21
|
|
Hi,
I'm sending a value, in this case a unique reference number like for
example 12007. I'm doing this by pulling it out of a record and displaying
it as a hyperlink. This reference number field is of text type. so my code
is like this:
-------
<a href=comp-reg.asp?num=<%=bRS("NoRef")%>>Number: <%=bRS("NoRef")%></a>
After that, once the user clicks the link that number goes to another asp
page named comp-reg.asp, where I pull out the number passed from the link
and I assign it to a variable like this:
--------
Dim num
num=Request.QueryString("num")
So far, the number gets passed through just fine. The problem comes when I
execute the SQL statement, which I define like this:
----------
oRS.Open "SELECT * FROM tblReq WHERE NoRef=' & num & ';", Conn
After the SQL is executed I try to display all of the fields related to
that specific record's reference number, like the name, address, etc, for
example:
------
Response.Write "Name:" & oRS("Name")
Response.Write "Address" & oRS("Address")
But in doing that I get this error message:
error '80020009' Exception occurred at line 23 which is the first
Response.Write. I think the error has to do with a type mismatch or I'm
doing it wrong with the SQL statement, because apparently the query
doesn't find any matching records, although the matching record exists
because I already pulled the Reference number out of it.
Please any help would be greatly appreciated, or an alternative way to
pull out all of a record's fields from a hyperlink by displaying that
record's reference number.
Thank you...
Omare
Message #2 by Jon Sidnell <jon.sidnell@b...> on Mon, 22 Jul 2002 16:22:04 +0100
|
|
I think you're right when you suggest it's a quote mark problem. I would
have written the SQL line like this:
oRS.Open "SELECT * FROM tblReq WHERE NoRef='" & num & "';", Conn
Doesn't mean I would be right, but as far as ASP would be concerned, the ' &
num & ' part is part of the connection string, so the SQL executed would be:
SELECT * FROM tblReq WHERE NoRef=' & num & ';
instead of replacing num with the actual number like you were wanting. Try
putting in the double quotemarks like I have above. It might work.
Cheers
Jon
-----Original Message-----
From: Omar Esquivel [mailto:omare@u...]
Sent: 22 July 2002 17:32
To: Access ASP
Subject: [access_asp] Bad SQL quotes? -- I get error '80020009'
Hi,
I'm sending a value, in this case a unique reference number like for
example 12007. I'm doing this by pulling it out of a record and displaying
it as a hyperlink. This reference number field is of text type. so my code
is like this:
-------
<a href=comp-reg.asp?num=<%=bRS("NoRef")%>>Number: <%=bRS("NoRef")%></a>
After that, once the user clicks the link that number goes to another asp
page named comp-reg.asp, where I pull out the number passed from the link
and I assign it to a variable like this:
--------
Dim num
num=Request.QueryString("num")
So far, the number gets passed through just fine. The problem comes when I
execute the SQL statement, which I define like this:
----------
oRS.Open "SELECT * FROM tblReq WHERE NoRef=' & num & ';", Conn
After the SQL is executed I try to display all of the fields related to
that specific record's reference number, like the name, address, etc, for
example:
------
Response.Write "Name:" & oRS("Name")
Response.Write "Address" & oRS("Address")
But in doing that I get this error message:
error '80020009' Exception occurred at line 23 which is the first
Response.Write. I think the error has to do with a type mismatch or I'm
doing it wrong with the SQL statement, because apparently the query
doesn't find any matching records, although the matching record exists
because I already pulled the Reference number out of it.
Please any help would be greatly appreciated, or an alternative way to
pull out all of a record's fields from a hyperlink by displaying that
record's reference number.
Thank you...
Omare
This message and any attachments (the "message") are intended solely
for the addressees and are confidential. If you receive this message
in error, please delete it and immediately notify the sender.
Any use not in accord with its purpose, any dissemination or
disclosure, either whole or partial, is prohibited except formal
approval.
The internet can not guarantee the integrity of this message.
BNP PARIBAS LEASE GROUP PLC (and its subsidiaries)
shall (will) not therefore be liable for the message if modified.
Message #3 by Jon Sidnell <jon.sidnell@b...> on Mon, 22 Jul 2002 16:27:20 +0100
|
|
Sorry, I forgot.
I think that if you're searching for a number, you don't have to include the
single quote marks at all, 'cos that's used to search for a string value in
SQL. So it should be OK to just say
oRS.Open "SELECT * FROM tblReq Where NoRef=" & num & "';", Conn.
on
-----Original Message-----
From: Jon Sidnell [mailto:jon.sidnell@b...]
Sent: 22 July 2002 16:22
To: Access ASP
Subject: [access_asp] RE: Bad SQL quotes? -- I get error '80020009'
I think you're right when you suggest it's a quote mark problem. I would
have written the SQL line like this:
oRS.Open "SELECT * FROM tblReq WHERE NoRef='" & num & "';", Conn
Doesn't mean I would be right, but as far as ASP would be concerned, the ' &
num & ' part is part of the connection string, so the SQL executed would be:
SELECT * FROM tblReq WHERE NoRef=' & num & ';
instead of replacing num with the actual number like you were wanting. Try
putting in the double quotemarks like I have above. It might work.
Cheers
Jon
-----Original Message-----
From: Omar Esquivel [mailto:omare@u...]
Sent: 22 July 2002 17:32
To: Access ASP
Subject: [access_asp] Bad SQL quotes? -- I get error '80020009'
Hi,
I'm sending a value, in this case a unique reference number like for
example 12007. I'm doing this by pulling it out of a record and displaying
it as a hyperlink. This reference number field is of text type. so my code
is like this:
-------
<a href=comp-reg.asp?num=<%=bRS("NoRef")%>>Number: <%=bRS("NoRef")%></a>
After that, once the user clicks the link that number goes to another asp
page named comp-reg.asp, where I pull out the number passed from the link
and I assign it to a variable like this:
--------
Dim num
num=Request.QueryString("num")
So far, the number gets passed through just fine. The problem comes when I
execute the SQL statement, which I define like this:
----------
oRS.Open "SELECT * FROM tblReq WHERE NoRef=' & num & ';", Conn
After the SQL is executed I try to display all of the fields related to
that specific record's reference number, like the name, address, etc, for
example:
------
Response.Write "Name:" & oRS("Name")
Response.Write "Address" & oRS("Address")
But in doing that I get this error message:
error '80020009' Exception occurred at line 23 which is the first
Response.Write. I think the error has to do with a type mismatch or I'm
doing it wrong with the SQL statement, because apparently the query
doesn't find any matching records, although the matching record exists
because I already pulled the Reference number out of it.
Please any help would be greatly appreciated, or an alternative way to
pull out all of a record's fields from a hyperlink by displaying that
record's reference number.
Thank you...
Omare
This message and any attachments (the "message") are intended solely
for the addressees and are confidential. If you receive this message
in error, please delete it and immediately notify the sender.
Any use not in accord with its purpose, any dissemination or
disclosure, either whole or partial, is prohibited except formal
approval.
The internet can not guarantee the integrity of this message.
BNP PARIBAS LEASE GROUP PLC (and its subsidiaries)
shall (will) not therefore be liable for the message if modified.
This message and any attachments (the "message") are intended solely
for the addressees and are confidential. If you receive this message
in error, please delete it and immediately notify the sender.
Any use not in accord with its purpose, any dissemination or
disclosure, either whole or partial, is prohibited except formal
approval.
The internet can not guarantee the integrity of this message.
BNP PARIBAS LEASE GROUP PLC (and its subsidiaries)
shall (will) not therefore be liable for the message if modified.
Message #4 by "Omar Esquivel" <omare@u...> on Mon, 22 Jul 2002 16:53:00
|
|
It worked !!!!!!
THANK YOU SO MUCH JON!!!!
Message #5 by "Larry Woods" <larry@l...> on Mon, 22 Jul 2002 08:50:16 -0700
|
|
Omar,
Putting quotation marks around a value is telling Jet that this
is a STRING! You want to remove the single-quote marks. Now Jet
will recognize this as a NUMBER.
oRS.Open "SELECT * FROM tblReq WHERE NoRef= & num & ";", Conn
Hope this helps.
Larry Woods - MCSD, MCT
> -----Original Message-----
> From: Omar Esquivel [mailto:omare@u...]
> Sent: Monday, July 22, 2002 4:32 PM
> To: Access ASP
> Subject: [access_asp] Bad SQL quotes? -- I get error '80020009'
>
>
>
> Hi,
>
> I'm sending a value, in this case a unique reference
> number like for
> example 12007. I'm doing this by pulling it out of a
> record and displaying
> it as a hyperlink. This reference number field is of
> text type. so my code
> is like this:
>
> -------
>
> <a href=comp-reg.asp?num=<%=bRS("NoRef")%>>Number:
> <%=bRS("NoRef")%></a>
>
> After that, once the user clicks the link that number
> goes to another asp
> page named comp-reg.asp, where I pull out the number
> passed from the link
> and I assign it to a variable like this:
>
> --------
> Dim num
> num=Request.QueryString("num")
>
> So far, the number gets passed through just fine. The
> problem comes when I
> execute the SQL statement, which I define like this:
>
> ----------
>
> oRS.Open "SELECT * FROM tblReq WHERE NoRef=' & num & ';", Conn
>
> After the SQL is executed I try to display all of the
> fields related to
> that specific record's reference number, like the
> name, address, etc, for
> example:
>
> ------
>
> Response.Write "Name:" & oRS("Name")
> Response.Write "Address" & oRS("Address")
>
> But in doing that I get this error message:
>
> error '80020009' Exception occurred at line 23 which
> is the first
> Response.Write. I think the error has to do with a
> type mismatch or I'm
> doing it wrong with the SQL statement, because
> apparently the query
> doesn't find any matching records, although the
> matching record exists
> because I already pulled the Reference number out of it.
>
> Please any help would be greatly appreciated, or an
> alternative way to
> pull out all of a record's fields from a hyperlink by
> displaying that
> record's reference number.
>
> Thank you...
> Omare
|
|
 |