PDA

Click to See Complete Forum and Search --> : Add Field to Access DB in C# .Net


bungeye
Mar 24th, 2004, 08:58 PM
I have an access DB that I want to add a new field to a table in C#.Net

Previously I have been doing this by creating an OLEDB Connection and running the ALTER TABLE SQL statement. This works fine.

But now I want to set some of the properties of the field (Allow Zero Length, Required, Default Value, Unicode Compression etc).
And haven't yet been able to find a way to do this.

Can anyone out there help me!!

Pirate
Mar 25th, 2004, 10:39 AM
The only way I could found is by utilizing ADOX library . Here's an example in VB.NET(didn't have time to port it to C#) .It creates new blank database with all the fields and the settings you choose . Have a look at the ADOX.DataTypeEnum (if I still remember the name correctly) .http://www.vbforums.com/showthread.php?s=&threadid=251384