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 8269475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:14:16+00:00 2026-06-08T06:14:16+00:00

I’ve been tasked with patching a Delphi software to work with a new database(mssql)

  • 0

I’ve been tasked with patching a Delphi software to work with a new database(mssql) structure.
In the previous database(mssql), all the columns being read were in the same table.
In the new version the file_name and class_name are in a different table as the quantity values.
I believe I can fix this by writing a Join for these two database tables.
Issue is, I’m not familiar with Delphi!
The current code is below.
How do I get these two databases to join into one?

dataTable=style001
dataTable1=style

THANKS!!!

  dataTable.Active := True;
  datatable.Open;
  dataTable1.Active := True;
  datatable1.Open;

  while not datatable1.Eof do
  begin
    Application.ProcessMessages;

    file_name := trim(datatable1.FieldByName('code').asString) + '.jpg';
    class_name := trim(datatable1.FieldByName('category').asString);

    if not FileExists(picfolder + file_name) then
    begin
      dataTable1.next;
      continue;
    end;

    instock := datatable.FieldByName('onhand').asString;
    TryStrToInt(instock, instock_num);

    quantity := datatable.FieldByName('onorder').asString;
    TryStrToInt(quantity, num);

    num := instock_num - num;

    is_active := ( num > 10 );


    for i := 0 to file_count-1 do
    begin
      if is_active = active_class[file_class[i]] then
      if SameText(files[i],file_name) then
      begin // use TStringList instead
        if SameText(class_name, classes[file_class[i]]) then // same class
        begin
          file_ok[i] := true;
          class_ok[file_class[i]] := true;
        end;
        break;
      end;
    end;

    if class_name <> '' then class_name := class_name + '\';
    dest := picfolder + active_path[is_active] + class_name;
    deldest := picfolder + active_path[not is_active] + class_name;

    {$I-}

    if FileExists(deldest + file_name) then
      DeleteFile(PChar(deldest + file_name ));

    if not FileExists(dest + file_name) then
    begin
      ForceDirectories(dest);
      CopyFile(PChar(picfolder + file_name ), PChar(dest + file_name ), true );
    end;

    dataTable1.next;
  end;

  for i := 0 to file_count-1 do
    if not file_ok[i] then
    begin // delete wrong file if empty
//      ShowMessage('problem: ' + picfolder + active_path[active_class[file_class[i]]] + classes[file_class[i]] + '\' + files[i]);
      DeleteFile(picfolder + active_path[active_class[file_class[i]]] + classes[file_class[i]] + '\' + files[i]);
    end;
  for i := 0 to class_count-1 do
    if not class_ok[i] then
    begin // delete old class if empty
//      ShowMessage('problem: ' + picfolder + active_path[active_class[i]] + classes[i] + '\' );
      RemoveDir(picfolder + active_path[active_class[i]] + classes[i] + '\' );
    end;


  beep;
  dataTable.Active := False;
  dataTable1.Active := False;
  • 1 1 Answer
  • 0 Views
  • 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. Editorial Team
    Editorial Team
    2026-06-08T06:14:18+00:00Added an answer on June 8, 2026 at 6:14 am

    The JOIN is inside the SQL request, not the consuming loop code you are showing here.

    You have to use a TQuery instead of two TTable, and write a SQL select for joining the two tables.

    You have to modify the SQL request, add the two tables in the FROM clause of the SELECT, and a JOINture in the WHERE clause. See this article about JOIN.

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

Sidebar

Related Questions

I've been tasked with redesigning part of a ms-sql database structure which currently involves
Background: I've been tasked with converting an Access database application to ASP.Net C# MVC.
I have been tasked with converting some scripts referencing an Informix database to be
I've been tasked at work to write a detailed engineering plan for a logistics
I've been tasked with revisiting a database schema we designed and use internally for
I've been tasked to work on a project that has some confusing attributes. The
I've been tasked with creating a list of all possibilities using data in 8
I've been tasked with a problem that finds all the subsequences for a string.
I have been tasked with a project where I am to add a new
I have been tasked with finding a good fit for a database to use

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.