Board index » delphi » Create dBase-Table with language-driver

Create dBase-Table with language-driver

Hello,

I want to create a dBase-Table with Delphi. It should use a nondefault
langdriver. I can change the settings in the BDE but that is not so
good. I have tried to use a TDatabase-component and add
"LANGDRIVER=DB850DE0" to the properties - but that doesn't do anything.

Can anyoe help me?

 

Re:Create dBase-Table with language-driver


Quote
>I want to create a dBase-Table with Delphi. It should use a nondefault
>langdriver. I can change the settings in the BDE but that is not so
>good. I have tried to use a TDatabase-component and add
>"LANGDRIVER=DB850DE0" to the properties - but that doesn't do anything.

You will have to use the BDE API method dibCreateTable to do that
http://www.borland.com/devsupport/bde/bdeapiex/dbicreatetable.html
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Create dBase-Table with language-driver


Brian Bushay TeamB schrieb:

Quote

> You will have to use the BDE API method dibCreateTable to do that
> http://www.borland.com/devsupport/bde/bdeapiex/dbicreatetable.html

Thank you,

I found this page too, but it is a little bit difficult, because I
have to initialize the field descriptor.

I have created my fielddefs with TTable.FieldDefs.Add(...).
Is there any way to use this ready fielddefs without recoding all.

Alexander Lang

Re:Create dBase-Table with language-driver


Quote
>I have created my fielddefs with TTable.FieldDefs.Add(...).
>Is there any way to use this ready fielddefs without recoding all.

If you are asking about using TFieldDefs in dibCreateTable I don't know of a way
to do that.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Create dBase-Table with language-driver


On Thu, 08 Mar 2001 08:37:59 +0100, Alexander Lang

Quote
<l...@mueritz-comp.de> wrote:
>I have created my fielddefs with TTable.FieldDefs.Add(...).
>Is there any way to use this ready fielddefs without recoding all.

You can keep your existing code for creating the table and uses the
following method for changing the table language driver afterwards:

(include BDE in your uses list)
procedure ChangeTableLanguage(Table: TTable);
const
   OptData: PChar = 'DB437US0';    // dBASE ENU cp437
   OptDesc: FldDesc = (szName: 'LANGDRIVER'; iOffset: 0; iLen: 9);
var
   CursorProp: CurProps;
   TblDesc: CRTblDesc;
   DBHnd: hDBIDb;
begin
   Table.Open;
   Check(DbiGetCursorProps(Table.Handle, CursorProp));
   FillChar(TblDesc, SizeOf(TblDesc), #0);
   with TblDesc do
   begin
      StrCopy(szTblName, CursorProp.szName);
      StrCopy(szTblType, CursorProp.szTableType);
      // Set the language driver
      iOptParams := 1;
      pFldOptParams := @OptDesc;
      pOptData := OptData;
   end;
   DBHnd := Table.Database.Handle;
   Table.Close;
   Check(DbiDoRestructure(DBHnd, 1, @TblDesc, nil, nil, nil, False));
end;

HTH,

Jan

Re:Create dBase-Table with language-driver


Hi!

I'm a VB programmer, but I use dBase files. I use ADO to connect to dbase
fiels, but ADO needs BDE to do so. I've checked with Microsoft how to set
the language driver to 'Ascii' Ansi but they said that this was BDE's
responsibility. I've tried to change the language driver for the DBASE
driver. If I set it to 'Ascii' Ansi (Which I need it to be), my new dbase
table is ENU 437. Why???? Setting the language driver to something else than
american ENU 437 or 'Ascii' Ansi turns out blank or dbase file with out
language driver information.

I need to create a new table from an existing one with a new field. Since
the dbase file is populated I can't add a field (at least with ADO/BDE), so
if you don't have any solution or answer to the above, do you have any small
code or dll to add a field to a dbase table? I have Delphi 3.1 (stopped
using it) so I could get som Pascal code, but I will not have any BDE
aliases.

I'm need help fast.

Best regards

Harald ?. Lund

Quote
Jan Sprengers <j...@nospamplease.adm2000.be> wrote in message

news:3aa88b27.1579531@forums.inprise.com...
Quote
> On Thu, 08 Mar 2001 08:37:59 +0100, Alexander Lang
> <l...@mueritz-comp.de> wrote:

> >I have created my fielddefs with TTable.FieldDefs.Add(...).
> >Is there any way to use this ready fielddefs without recoding all.

> You can keep your existing code for creating the table and uses the
> following method for changing the table language driver afterwards:

> (include BDE in your uses list)

> procedure ChangeTableLanguage(Table: TTable);
> const
>    OptData: PChar = 'DB437US0';    // dBASE ENU cp437
>    OptDesc: FldDesc = (szName: 'LANGDRIVER'; iOffset: 0; iLen: 9);
> var
>    CursorProp: CurProps;
>    TblDesc: CRTblDesc;
>    DBHnd: hDBIDb;
> begin
>    Table.Open;
>    Check(DbiGetCursorProps(Table.Handle, CursorProp));
>    FillChar(TblDesc, SizeOf(TblDesc), #0);
>    with TblDesc do
>    begin
>       StrCopy(szTblName, CursorProp.szName);
>       StrCopy(szTblType, CursorProp.szTableType);
>       // Set the language driver
>       iOptParams := 1;
>       pFldOptParams := @OptDesc;
>       pOptData := OptData;
>    end;
>    DBHnd := Table.Database.Handle;
>    Table.Close;
>    Check(DbiDoRestructure(DBHnd, 1, @TblDesc, nil, nil, nil, False));
> end;

> HTH,

> Jan

Re:Create dBase-Table with language-driver


Quote
>I need to create a new table from an existing one with a new field. Since
>the dbase file is populated I can't add a field (at least with ADO/BDE), so
>if you don't have any solution or answer to the above, do you have any small
>code or dll to add a field to a dbase table? I have Delphi 3.1 (stopped
>using it) so I could get som Pascal code, but I will not have any BDE
>aliases.

My observation is that Microsoft if feeding you a load of BS.  When you set the
default language driver in the BDE config that is the language driver that gets
used in Delphi when you create a table.   If that is not what you see with the
MS ADO driver connected to Paradox tables then Microsoft has screwed up the
driver.
SQL supported by BDE allows you to add a field with SQL Alter Table statement.
Have you tried that from ADO?

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Create dBase-Table with language-driver


Hi!

Thank you for your answer.

I tested alter table, but ADO can't change a populatetd dbase table.

I also think that Microsoft screwed up the driver. I tested with DBASE III
driver from MS. It seemed to worke but the language wasn't set correctly.
Database Desktop showed it correctly but not my other dbase aware
applications. Any solution?

Harald

Brian Bushay TeamB <BBus...@Nmpls.com> wrote in message
news:dmetatgb29emgsai3t2el4c1u3t728cg9o@4ax.com...

Quote

> >I need to create a new table from an existing one with a new field. Since
> >the dbase file is populated I can't add a field (at least with ADO/BDE),
so
> >if you don't have any solution or answer to the above, do you have any
small
> >code or dll to add a field to a dbase table? I have Delphi 3.1 (stopped
> >using it) so I could get som Pascal code, but I will not have any BDE
> >aliases.

> My observation is that Microsoft if feeding you a load of BS.  When you
set the
> default language driver in the BDE config that is the language driver that
gets
> used in Delphi when you create a table.   If that is not what you see with
the
> MS ADO driver connected to Paradox tables then Microsoft has screwed up
the
> driver.
> SQL supported by BDE allows you to add a field with SQL Alter Table
statement.
> Have you tried that from ADO?

> --
> Brian Bushay (TeamB)
> Bbus...@NMPLS.com

Other Threads