Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Comma delimited files to Paradox

Posted on 1997-11-02
3
Medium Priority
?
408 Views
Last Modified: 2012-05-04
How do I import a comma delimited ascii file with variable field lengths to Paradox?
0
Comment
Question by:rainbowsoftware
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:Waldek
ID: 1349351
if not in code you may improt data to Excel and save as Paradox table
0
 
LVL 3

Accepted Solution

by:
Pegasus100397 earned 100 total points
ID: 1349352
Rainbow,

If you have access to Microsoft Access (pun intended) then you can simply "attach" or "link" to the Paradox table then import the .CSV data straight into the table.

Good luck with your project!
Pegasus
0
 

Author Comment

by:rainbowsoftware
ID: 1349353
What I really want is to make a Delphi application to handle all the
job from ASCII to PARADOX.
I have found a Freeware Component somewhere. It's a Table component
and handles comma delimited files, and it works fine in design time, but
running the program I get an error box telleing that the database canneot be accessed.
If someone could figure out why, I would appreciate it very much.
Here is the PAS-file:

unit Cdbascii;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, DbiErrs, DbiTypes, DbiProcs, DB, DBTables;

type
  TAsciiDelimTable = class(TTable)
  private
    { Private declarations }
    fQuote :Char;
    fDelim :Char;
  protected
    { Protected declarations }
    function CreateHandle: HDBICur; override;
    Procedure SetQuote(newValue :Char);
    Procedure SetDelim(newValue :Char);
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    { These properties shouldn't be published anymore }
    property IndexFieldNames;
    property IndexName;
    property MasterFields;
    property MasterSource;
    property UpdateMode;
  published
    { Published declarations }
    Property Quote:Char Read fQuote Write setQuote Default '"';
    Property Delim:Char Read fDelim Write setDelim Default ',';
  end;

procedure Register;

implementation

uses DBConsts;

procedure Register;
begin
  RegisterComponents('Data Access', [TAsciiDelimTable]);
end;

constructor TAsciiDelimTable.Create(AOwner: TComponent);
Begin
  Inherited Create(AOwner);
  Exclusive:=True;
  TableType:=ttASCII;
  fQuote := '"';
  fDelim := ',';
End;

destructor TAsciiDelimTable.Destroy;
Begin
  Inherited Destroy;
End;

{ Utility routines }

function CheckOpen(Status: DBIResult): Boolean;
begin
  case Status of
    DBIERR_NONE:
      Result := True;
    DBIERR_NOTSUFFTABLERIGHTS:
      begin
        if not Session.GetPassword then DbiError(Status);
        Result := False;
      end;
  else
    DbiError(Status);
  end;
end;

function TAsciiDelimTable.CreateHandle: HDBICur;
const
  OpenModes: array[Boolean] of DbiOpenMode = (dbiReadWrite, dbiReadOnly);
  ShareModes: array[Boolean] of DbiShareMode = (dbiOpenShared, dbiOpenExcl);
var
  STableName: array[0..SizeOf(TFileName) - 1] of Char;
  SDriverType: array[0..12] of Char;
begin
  if TableName = '' then DBError(SNoTableName);
  AnsiToNative(DBLocale, TableName, STableName, SizeOf(STableName) - 1);
  StrPCopy(SDriverType, 'ASCIIDRV-'+Quote+'-'+Delim);
  Result := nil;
  while not CheckOpen(DbiOpenTable(DBHandle, STableName, SDriverType,
    nil, nil, 0, OpenModes[ReadOnly], ShareModes[Exclusive],
    xltField, False, nil, Result)) do {Retry};
end;

Procedure TAsciiDelimTable.SetQuote(newValue :Char);
Begin
 If Active Then
 {    DBError(SInvalidBatchMove); };
 fQuote := newValue;
End;
Procedure TAsciiDelimTable.SetDelim(newValue :Char);
Begin
 If Active Then
    {    DBError(SInvalidBatchMove); };
 fDelim := newValue;
End;

end.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question