BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Change field property

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
MikeR
Guest





PostPosted: Mon Apr 30, 2007 7:50 am    Post subject: Change field property Reply with quote



I need to change a field in an existing Access 2000 db to allow zero length. The
following doesn't error, but it doesn't change the property either. Google turned up
tons of hits, but no working solution.
Thanks, Mike

procedure TForm1.Button1Click(Sender: TObject);
var
sql: string;
cat: _Catalog;
col : _Column;
table : _Table;
I,j: Integer;
cstr: string;
fName: olevariant;
begin
sql := 'ALTER TABLE [Log] ALTER COLUMN R_RST text(3)';
conn.Execute(sql);
conn.Close;
{ The above uses ADO to change the type from number to text.
Now change a property.}

cStr := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + DBName + ';Jet
OLEDB:Engine Type=5';
cat := CoCatalog.Create;
cat._Set_ActiveConnection(cStr);
table := CoTable.Create;
table := cat.Tables['Log'];
col := CoColumn.Create;
Col.ParentCatalog := cat;
fname := 'R_RST';
Col.Name := fName;
Col.Properties['Jet OLEDB:Allow Zero Length'].Value := true;
Back to top
MikeR
Guest





PostPosted: Mon Apr 30, 2007 11:54 pm    Post subject: Re: Change field property Reply with quote



Never mind. I was finally able to get into CodeCentral, and found the answer there.
Mike
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.