Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

join recordset with null field causing errors

Participant ,
Jan 04, 2007 Jan 04, 2007
The initial value of form fields on this page are populated by the following recordset containing a join:

SELECT *
FROM customers_cus, orders_ord
WHERE orders_ord.customerid_ord=customers_cus.customerid_cus AND company_cus='" & Request.Form("companymenu") &"'

Whenever the database field orders_ord.customerid_ord is not null, the form fields on the page preview fine. However, if orders_ord.customerid_ord is null, I receive the following error message:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

How do I make it that orders_ord.customerid_ord is able to be null?
TOPICS
Server side applications
247
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 04, 2007 Jan 04, 2007
First, abandon your outdated join syntax. Next, use an outer join instead.
If you join two tables on an inner join, then no records with a NULL in
either join column will be returned.

Also, don't use SELECT *. And you're vulnerable to SQL injection.

SELECT <columns>
FROM customers_cus
LEFT OUTER JOIN orders_ord ON
orders_ord.customerid_ord=customers_cus.customerid_cus
WHERE company_cus='" & Replace(Request.Form("companymenu"),"'","''") &"'

The replace above doesn't offer complete protecti...
Translate
LEGEND ,
Jan 04, 2007 Jan 04, 2007
LATEST
First, abandon your outdated join syntax. Next, use an outer join instead.
If you join two tables on an inner join, then no records with a NULL in
either join column will be returned.

Also, don't use SELECT *. And you're vulnerable to SQL injection.

SELECT <columns>
FROM customers_cus
LEFT OUTER JOIN orders_ord ON
orders_ord.customerid_ord=customers_cus.customerid_cus
WHERE company_cus='" & Replace(Request.Form("companymenu"),"'","''") &"'

The replace above doesn't offer complete protection, but it is at a minimum
what you should use to protect yourself.


"aonefun" <webforumsuser@macromedia.com> wrote in message
news:enjb11$3mt$1@forums.macromedia.com...
> The initial value of form fields on this page are populated by the
> following
> recordset containing a join:
>
> SELECT *
> FROM customers_cus, orders_ord
> WHERE orders_ord.customerid_ord=customers_cus.customerid_cus AND
> company_cus='" & Request.Form("companymenu") &"'
>
> Whenever the database field orders_ord.customerid_ord is not null, the
> form
> fields on the page preview fine. However, if orders_ord.customerid_ord is
> null,
> I receive the following error message:
>
> ADODB.Field error '800a0bcd'
>
> Either BOF or EOF is True, or the current record has been deleted.
> Requested
> operation requires a current record.
>
> How do I make it that orders_ord.customerid_ord is able to be null?
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines