Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 97939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:06:03+00:00 2026-05-11T00:06:03+00:00

Now I have seen this question in another forum but it didn’t had an

  • 0

Now I have seen this question in another forum but it didn’t had an acceptable answer.

Suppose I have two tables, the Groups table and the Elements table. The tables have no defined relationships. The Elements table has an IdGroup field that refers to the IdGroup (PK) field of the Groups table.

I use the following query through an ADO recordset to populate the tables values to a datagrid:

SELECT Elements.*, Groups.GroupName FROM Elements INNER JOIN Groups ON Elements.IdGroup = Groups.IdGroup 

From that grid I want to press Delete in order to delete an Element. Here is my problem. When I used DAO, the DAO Delete() function deleted only the record in the Elements group. This was the expected behavior.

When I changed to ADO, the Delete() function deleted records in both tables, the element record and the group to which the element belonged!

Is there any way to reproduce the DAO behavior in ADO without having to define relationships into the tables?

Note: I know there are alternatives (executing DELETE querys could do the job). Just show me a way to do this in ADO, or say it cannot be done.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:06:04+00:00Added an answer on May 11, 2026 at 12:06 am

    Rewrite you query to:

    • replace the INNER JOIN with a WHERE clause consisting of an EXISTS;
    • use a subquery in the SELECT clause to return the value of Groups.GroupName.

    Example:

    SELECT Elements.*,         (         SELECT Groups.GroupName           FROM Groups           WHERE Elements.IdGroup = Groups.IdGroup        )   FROM Elements  WHERE EXISTS (                SELECT *                   FROM Groups                  WHERE Elements.IdGroup = Groups.IdGroup               ); 

    I’ve tested this using SQL Server 2008 with a ADO recordset set as the DataSource property of a Microsoft OLEDB Datagrid Control (MSDATGRD.OCX) then deleting the row via the gird (I assume you are doing something similar) and the row is indeed deleted from table Elements only (i.e. the row in Groups remains undeleted).

    Note the revised query may have a negative impact on performance when fetching rows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think I have seen this question before but I don't think it's answered
I have seen this question a couple of times here in SO but none
I have seen many versions of this question but the answers always turn into
Please help, clarify this issue, I have seen it on many sites now, you
Ok I have another question HERE for my Logging Class but I wanted to
I have seen a question on here about this however it was old so
Now I have something that I have not seen it before: the database is
I have seen a few sites now where if you highlight text of an
I am a Java programming now also writing in C#. I have seen Accessor
Language Integrated Query. Now I know that the acronyms are. I have seen C#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.