mrdutchie Posted August 12, 2003 Posted August 12, 2003 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 Quote
fsX Posted August 19, 2004 Posted August 19, 2004 Hmmm... I'd like to know how you did this, using C# if possible. Thx. Quote
Joe Mamma Posted August 19, 2004 Posted August 19, 2004 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? Quote 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.
fsX Posted August 19, 2004 Posted August 19, 2004 Thanks Joe Mamma, That helped I got it working doing this: oTab.Columns["Email"].Attributes = ADOX.ColumnAttributesEnum.adColNullable; :D Quote
Joe Mamma Posted August 19, 2004 Posted August 19, 2004 Thanks Joe Mamma, That helped I got it working doing this: oTab.Columns["Email"].Attributes = ADOX.ColumnAttributesEnum.adColNullable; :Dcool. . . 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. Quote 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.
Arch4ngel Posted August 19, 2004 Posted August 19, 2004 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. Quote "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
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.