QurbanDurrani
asked on
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.
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;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
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.
Open in new window