Board index » delphi » How to modify the size of a paradox field ?

How to modify the size of a paradox field ?

 How to modify the size of a paradox field in Delphi ?
(like the Database-Explorer ?)

This will not work (readonly)!

Table1.FieldDefs.items[1].size:=newSize;

Thanks

Martin

 

Re:How to modify the size of a paradox field ?


You will probably have to get into the dirty details of the BDE and call

the dbiDoRestructure procedure.  There are help files for this...you can
figure it from the help files..but it is not a trivial task.  You will
also want to look at the BDE.int and BDEConst.int files (in the "Docs"
directory).

Quote
Martin Schumann wrote:
>  How to modify the size of a paradox field in Delphi ?
> (like the Database-Explorer ?)

> This will not work (readonly)!

> Table1.FieldDefs.items[1].size:=newSize;

> Thanks

> Martin

Re:How to modify the size of a paradox field ?


You are getting the read-only response because you are not modifying
the table structure itself, just attempting to modify a property that
pulls its values from the table structure.

What I would do is load up Database Explorer and use SQL.  The
following snippet shows how to increase a field's size (in the below
example the COMMENTS field of the MARTINTABLE table by creating a
temporary larger-size-field, copying all the values to it, destroying
the old field, re-creating the new field with a bigger size, copying
the bigger-sized temp field contents to the new bigger "real" field,
then cleaning up the temporary field (whew):

ALTER TABLE MARTINTABLE
ADD string1 CHAR(500);

UPDATE MARTINTABLE
SET string1 = COMMENTS;

ALTER TABLE MARTINTABLE
DROP COMMENTS;

ALTER TABLE MARTINTABLE
ADD COMMENTS CHAR(500);

UPDATE MARTINTABLE
SET COMMENTS = string1;

ALTER TABLE MARTINTABLE
DROP string1;

Good luck,

-Peter

On Wed, 11 Nov 1998 16:32:22 +0100, "Martin Schumann"

Quote
<mschu...@inf.fu-berlin.de> wrote:
> How to modify the size of a paradox field in Delphi ?
>(like the Database-Explorer ?)

>This will not work (readonly)!

>Table1.FieldDefs.items[1].size:=newSize;

>Thanks

>Martin

Re:How to modify the size of a paradox field ?


Oops, add to my previous post that you should embed the above
statements in TQuery's (since you want to do it from code and not from
Database Explorer, though you may want to test the process in Database
Explorer).

-Peter

On Wed, 11 Nov 1998 16:32:22 +0100, "Martin Schumann"

Quote
<mschu...@inf.fu-berlin.de> wrote:
> How to modify the size of a paradox field in Delphi ?
>(like the Database-Explorer ?)

>This will not work (readonly)!

>Table1.FieldDefs.items[1].size:=newSize;

>Thanks

>Martin

Re:How to modify the size of a paradox field ?


I've looked at this quite some time ago. I think by far the easiest is
SQL commands (create a temp field, copy the data over to it, erase the
one you want to change, create it with it's new size, copy the data over
from the temp field, erase the temp field). Getting into the BDE is
quite complicated and suffers from good help.

Ed Dressel

Quote
Martin Schumann wrote:
>  How to modify the size of a paradox field in Delphi ?
> (like the Database-Explorer ?)

> This will not work (readonly)!

> Table1.FieldDefs.items[1].size:=newSize;

> Thanks

> Martin

Re:How to modify the size of a paradox field ?


See the examples for DbiDoRestructure at
www.inprise.com/devsupport/bde/bdeapiex.

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Other Threads