🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #2835

Accessing data from Access DB control issue different than SQL 2000?

#2835
From: Andrew
Date: Thu, 06 Mar 2003 17:02
40 lines
2027 bytes
Hi,
I am using Window 98 SE, BCB5 Pro, Office XP Pro
I hope this is the right forum.

I have built a table in Access : (such as)
  Group_Name      Item_Name
  --------------+----------
  Lights          Interior
  Lights          Exterior
  Power           Doorway
  Power           Window

I can access the DB OK, put into a table, all is fine.
When I try to query DB, the SQL does not seem to filter.

  Query1->SQL->Clear();
  Query1->Close();
  Query1->SQL->Add("SELECT Item_Name FROM table_name WHERE Group_Name = 'Lights'");
  Query1->Active=true;
  Query1->Open();
  DataSource1->DataSet->ControlsDisabled();
  DataSource1->DataSet->First();
  int countmax=DataSource1->DataSet->RecordCount;
  for (int i=0;i<countmax;i++)
  {
    DataSource1->DataSet->GetCurrentRecord(item_name);
    ListBox1->Items->Add(group_name);
    DataSource1->DataSet->Next();
  }

  
This will list all contents of the database under Item_Name,
even thought they don't match the Query criteria.
It should only list the first two ?

This worked for SQL 2000, but not for Access?
how do I tweak this?

Thanks in advance.
Andrew
Technical Details
Message-ID: <3e677f28$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,e89b105f1cb46fd8,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-03-06 09:09:51 PST
From: "Andrew" <houston@compusmart.ab.ca>
Sender: "Andrew" <houston@compusmart.ab.ca>
Reply-To: "Andrew" <houston@compusmart.ab.ca>
Subject: Accessing data from Access DB control issue different than SQL 2000?
Newsgroups: borland.public.cppbuilder.database.ado
X-User-Info: 209.115.210.239 209.115.210.239    
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3e677f28$1@newsgroups.borland.com>
Date: 6 Mar 2003 09:02:32 -0800
X-Trace: newsgroups.borland.com 1046970152 207.105.83.65 (6 Mar 2003 09:02:32 -0800)
Lines: 43
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mail