Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

When I create a Access DB file how/where do I set the command so that I can change 1 field to be "Not Required" ?

 

 

ADOXtable1.Name = "Addressbook"

ADOXtable1.Columns.Append("Prefix", ADOX.DataTypeEnum.adVarWChar, 50)

ADOXtable1.Columns.Append("Firstname", ADOX.DataTypeEnum.adVarWChar, 50)

ADOXtable1.Columns.Append("Middlename", ADOX.DataTypeEnum.adVarWChar, 50)

ADOXtable1.Columns.Append("Lastname", ADOX.DataTypeEnum.adVarWChar, 50)

ADOXtable1.Columns.Append("Address1", ADOX.DataTypeEnum.adVarWChar, 50)

ADOXtable1.Columns.Append("Address2",

ADOXtable1.Columns.Append("ID", ADOX.DataTypeEnum.adDouble, 10)

ADOXcatalog.Tables.Append(ADOXtable1)

 

With this all Fields are Required when I look in Access,

how to change it to NOT Required?

 

Thanks

  • 1 year later...
Posted
Hmmm...

I'd like to know how you did this, using C# if possible.

Thx.

can you add ADOX.ColumnAttributesEnum.adColNullable to the ADOX._Column.Attributes property?

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted

Thanks Joe Mamma,

 

That helped I got it working doing this:

oTab.Columns["Email"].Attributes = ADOX.ColumnAttributesEnum.adColNullable;

 

:D

Posted
Thanks Joe Mamma,

 

That helped I got it working doing this:

oTab.Columns["Email"].Attributes = ADOX.ColumnAttributesEnum.adColNullable;

 

:D

cool. . . but I think you want to do += adColNullable, so you dont clear out a adColFixed setting that might already be there. even though you are using a varchar for email at this time, you might find yourself making a change down the line or putting this in some factory function and then you might be wondering 'why is this field not a fixed length???' at a latter date.

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted

Better solution ?????

 

oTab.Columns["Email"].Attributes = oTab.Columns["Email"].Attributes | ADOX.ColumnAttributesEnum.adColNullable;

Is this can be correct ? Maybe even better ? Tell me why if it's not.

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...