Modify Schema

  • Thread starter Thread starter T. Ford
  • Start date Start date
T

T. Ford

How does one modify the schema of a table via ADO.NET? I know that you can
do a lot with just SQL statements. Using ALTER TABLE, ALTER COLUMN, etc work
great for SOME databases. But there are things you can't do with SQL for
some databases. For example, with ACCESS, you cannot modify the primary key
and you cannot set default values for columns. I've found a way to set
default values, in DAO for Access. I've found a way to get the primary keys
using DAO for Access. I have not found a way to change the primary keys
using DAO though. I'm sort of looking in to ADO and ADOX, but would much
rather using ADO.NET. I see a lot of examples out there for getting schema
information, but nothing for actually modifying it with ADO.NET. Either it
can be done and nobody is documenting it, it can be done and I'm terrible at
searching, or it cannot be done. Anyone have any examples on this?

Thanks.

T. Ford
 
T. Ford said:
How does one modify the schema of a table via ADO.NET? I know that you can
do a lot with just SQL statements. Using ALTER TABLE, ALTER COLUMN, etc work
great for SOME databases. But there are things you can't do with SQL for
some databases. For example, with ACCESS, you cannot modify the primary key
and you cannot set default values for columns. I've found a way to set
default values, in DAO for Access. I've found a way to get the primary keys
using DAO for Access. I have not found a way to change the primary keys
using DAO though. I'm sort of looking in to ADO and ADOX, but would much
rather using ADO.NET. I see a lot of examples out there for getting schema
information, but nothing for actually modifying it with ADO.NET. Either it
can be done and nobody is documenting it, it can be done and I'm terrible at
searching, or it cannot be done. Anyone have any examples on this?

OK, looks like I've found a way to deal with the Primary keys with SQL
(DDL). I can use DROP INDEX and CREATE INDEX. So that works great. What
about Default Values with ADO.NET?

Thanks,

T. Ford
 
ALTER TABLE is a good start for changes on a table or columns. Have not
tried adding a default that way, but it would be the first thing I look at.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
Back
Top