Trying to add a memo field to a paradox table at runtime.

Hi Experts,
I have attached the function call and the function itself. The code works fine when adding an Alpha or integer column, but it errors out when adding a memo field. I am probably not calling the function correctly. Wonder whats wrong with it.
//This function call works just fine
if  DFieldExists('TABS_Coll_IP','CONFIG','port') = false then
   begin
    DAddField('TABS_Coll_IP CHAR(15)', 'CONFIG', 'port');
    porttablechg := TRUE;
   end;
 
//This function call errors out
if  DFieldExists('Derived_Relation_Raw','CONFIG','point') = false then
   begin
    DAddField('TABS_Coll_IP Memo', 'CONFIG', 'point');
    pointtablechg := TRUE;
   end;
 
//This is the function being called
Function DAddField(flddef, dbName,tblName: String): Boolean;
var q : TQuery;
 
begin
       q := TQuery.Create(nil);
       try
       q.DatabaseName := dbName;
       q.Sql.Add('ALTER TABLE ' + tblName );
       q.sql.add(' ADD COLUMN ' + fldDef );
 
       q.ExecSQL;
 
       finally
       q.free;
       end;
end;

Open in new window

QurbanDurraniAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rfwoolfCommented:
If you are using the BDE then I believe you need to call the dbiDoRestructure or something function using the BDE - you should come right by searchng for similar questions on ee such as "paradox add field" or "paradox rename field" or "paradox delete field" etc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
QurbanDurraniAuthor Commented:
Thanks rfwoolf for your response.
I actually figured it out with the help of a friend of mine. You deserve the points for at least trying. I'll attach the corrected code. I actually had to replace the word 'Memo' with 'BLOB' in the call to the function.

//corrected function call
if  DFieldExists('Derived_Relation_Raw','CONFIG','point') = false then
   begin
    DAddField('Derived_Relation_Raw BLOB', 'CONFIG', 'point');
    pointtablechg := TRUE;
   end;

Open in new window

0
rfwoolfCommented:
That's very kind of you QurbanDurrani.
I recall a whle back I did manage to make certain changes using SQL, but other changes like renaming a field I think  had to use the BDE's routines like dbiDorestructure.
 
I have since migrated to Firebird (recently actually) which was a very gruelling process because my entire application was strongly bound to paradox and firebird had all kinds of data idiosynchrisys but in the end I think it was worth it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.