Board index » delphi » Opening a Table from floppy or hard drive

Opening a Table from floppy or hard drive

I have a opendialog component that I trying to use to open a table from
a drive. I created the table on the drive from code. I am trying to open
the table from the drive and append the records inside of it into
another table located in the program. Is the difficult to do? I am using
d4 and paradox.

Thanks Mike

 

Re:Opening a Table from floppy or hard drive


On Fri, 03 Mar 2000 11:31:56 -0800, Mike Esposito

Quote
<espom...@hotmail.com> wrote:
>I have a opendialog component that I trying to use to open a table from
>a drive. I created the table on the drive from code. I am trying to open
>the table from the drive and append the records inside of it into
>another table located in the program. Is the difficult to do? I am using
>d4 and paradox.

The DatabaseName property of a TTable or TQuery component can be set
to a string containing the drive and directory where a table resides.
(This is as opposed to setting this property to the name of a BDE
alias.) You can get this string from a TOpenDialog by passing its
FileName property through the ExtractPath function. Similarly, you can
get the file name for the selected table by using the ExtractFileName
function on the FileNam property.

  if OpenDialog1.Execute then
    with Table1 do begin
      Close;
      DatabaseName := ExtractFilePath(OpenDialog1.FileName);
      TableName := ExtractFileName(OpenDialog1.FileName);
      Open;
    end;

===========================================================
Steve Koterski
Technical Publications
Borland

Re:Opening a Table from floppy or hard drive


How would I call this Table if is called 'Test.DB' how would I trnasform this
into code to open it and be able to copy records from it?

Thanks Mike

Quote
Steve Koterski wrote:
> On Fri, 03 Mar 2000 11:31:56 -0800, Mike Esposito
> <espom...@hotmail.com> wrote:

> >I have a opendialog component that I trying to use to open a table from
> >a drive. I created the table on the drive from code. I am trying to open
> >the table from the drive and append the records inside of it into
> >another table located in the program. Is the difficult to do? I am using
> >d4 and paradox.

> The DatabaseName property of a TTable or TQuery component can be set
> to a string containing the drive and directory where a table resides.
> (This is as opposed to setting this property to the name of a BDE
> alias.) You can get this string from a TOpenDialog by passing its
> FileName property through the ExtractPath function. Similarly, you can
> get the file name for the selected table by using the ExtractFileName
> function on the FileNam property.

>   if OpenDialog1.Execute then
>     with Table1 do begin
>       Close;
>       DatabaseName := ExtractFilePath(OpenDialog1.FileName);
>       TableName := ExtractFileName(OpenDialog1.FileName);
>       Open;
>     end;

> ===========================================================
> Steve Koterski
> Technical Publications
> Borland

Other Threads