[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to Create a Access Table that can accept Null value

Posted on 2002-06-24
7
Medium Priority
?
198 Views
Last Modified: 2010-04-04
Below are part of my code ...

....
..
uses ADOX_TLB, ComObj;

procedure TForm1.Button1Click(Sender: TObject);
Var     Catalog : _Catalog;
        Table   : _Table;
        BaseName : String;
        DS      : String;
begin
    BaseName := 'C:\DATA.mdb';
    Catalog := CreateComObject(StringToGUID('ADOX.Catalog'))as _Catalog;
    DS := 'Provider=Microsoft.jet.OLEDB.4.0;Data Source='+BaseName;
    Catalog.Create(DS);
    Table := CreateComObject(StringToGUID('ADOX.Table'))as _Table;
    Table.Name := 'FILO';
    Catalog.Tables.Append(Table);
    Table.Columns.Append('CardID',adVarWChar,12);
    Table.Columns.Append('Name',adVarWChar,20);
    Table.Columns.Append('Department',adVarWChar,12);
....
..

My problem is :-
How to set the Fields type so it can accept the null value. (Do not do the Validity Check)

0
Comment
Question by:nclong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7103372
Hello

try this

  Table.Columns['Department'].Attributes  :=  adColNullable
0
 
LVL 2

Expert Comment

by:Griffon
ID: 7104227
Most access table seem to accept null values...

if you are haveing problems with sending null values to an access table then try setting the emptystringtonull property to enAlways.

if it was just setting it then I thought that was the default in access *shrugs*

if I am totally out of it and barking way up the wrong tree then sorry :)
0
 

Author Comment

by:nclong
ID: 7106347
To : mnasman

I'd try as u suggested, but it show the error as below :-

'EOleException Error, multiple-Step OLE DB operatio Generated Errors'

any ideas ??
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 400 total points
ID: 7106945
ok, try to add the field as this way

var
  Col : _Column;
...
  Col.Name := 'Deparament';
  Col.Attributes := adColNullable;
  Col.Type_ := adVarWChar;
  Col.DefinedSize := 12;
  Table.Columns.Append (Col, adVarWChar, 12);

Best regards
Mohammed Nasman
0
 

Author Comment

by:nclong
ID: 7109755
Thks, Mnasman. your method work fine now.
btw, do u know how to add in the Table Description ?? I'll increase the point to 200 if u can help me on this.

Regards,
Raymond

0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7126512
Hello Raymond

  I really tried hard to find that, even in microsoft site, there's no info about that, i just found how to read the table desc using visual basic, but not to write it



0
 

Author Comment

by:nclong
ID: 7137232
anywhere, thks for your help.

just mail it to me at raymond@asistech.com.sg if you has any idea.

Thks,

Regards,
Raymond.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question